messages: refactoring and REST API 

Refactoring of the messages module. An api.py file has been created in order to interact with the database. Also a restful.py file has been created so that messages can have a REST API.
1: D205 Blank line missing between one-line summary and description
57:1: F401 'CFG_BIBFORMAT_CACHED_FORMATS' imported but unused
58:6: E126 continuation line over-indented for hanging indent
63:6: E126 continuation line over-indented for hanging indent
65:6: E126 continuation line over-indented for hanging indent
74:6: E126 continuation line over-indented for hanging indent
78:1: F401 'CFG_BIBFORMAT_TEMPLATES_DIR' imported but unused
78:1: F401 'CFG_BIBFORMAT_OUTPUTS_PATH' imported but unused
79:6: E126 continuation line over-indented for hanging indent
86:6: E126 continuation line over-indented for hanging indent
89:6: E126 continuation line over-indented for hanging indent
102:27: E261 at least two spaces before inline comment
103:28: E111 indentation is not a multiple of four
103:28: E113 unexpected indentation
104:28: E111 indentation is not a multiple of four
104:28: E113 unexpected indentation
105:28: E111 indentation is not a multiple of four
105:28: E113 unexpected indentation
108:28: E111 indentation is not a multiple of four
108:28: E113 unexpected indentation
122:33: E225 missing whitespace around operator
213: D203 Expected 1 blank line *before* class docstring, found 0
217: D401 First line should be imperative: 'Return', not 'Returns'
217: D400 First line should end with '.', not 's'
229: D401 First line should be imperative: 'Return', not 'Returns'
254: D102 Docstring missing
293: D103 Docstring missing
299: D401 First line should be imperative: 'Format', not 'Formats'
299: D400 First line should end with '.', not 'f'
299: D205 Blank line missing between one-line summary and description
346:45: E127 continuation line over-indented for visual indent
489:27: E225 missing whitespace around operator
493:5: E303 too many blank lines (2)
510:82: E225 missing whitespace around operator
552: D103 Docstring missing
568: D401 First line should be imperative: 'Return', not 'Returns'
568: D202 No blank lines allowed *after* function docstring, found 1
568: D400 First line should end with '.', not 'g'
568: D205 Blank line missing between one-line summary and description
589:64: E261 at least two spaces before inline comment
589:65: E262 inline comment should start with '# '
596:38: E261 at least two spaces before inline comment
596:39: E262 inline comment should start with '# '
597:48: E261 at least two spaces before inline comment
597:49: E262 inline comment should start with '# '
600:24: E127 continuation line over-indented for visual indent
609: D103 Docstring missing
612: D400 First line should end with '.', not 's'
612: D200 One-line docstring should not occupy 3 lines
625: D290 White spaces around docstring should be trimmed.
625: D400 First line should end with '.', not 'a'
625: D205 Blank line missing between one-line summary and description
657:57: E126 continuation line over-indented for hanging indent
664:5: E303 too many blank lines (2)
723: D401 First line should be imperative: 'Evalute', not 'Evalutes'
743: D401 First line should be imperative: 'Analyse', not 'Analyses'
743: D202 No blank lines allowed *after* function docstring, found 1
812: D401 First line should be imperative: 'Return', not 'Returns'
812: D400 First line should end with '.', not 't'
812: D205 Blank line missing between one-line summary and description
942:78: E225 missing whitespace around operator
943:54: E225 missing whitespace around operator
975:47: E261 at least two spaces before inline comment
990:27: E225 missing whitespace around operator
1050: D401 First line should be imperative: 'Filter', not 'Filters'
1060: D401 First line should be imperative: 'Searche', not 'Searches'
1060: D400 First line should end with '.', not 's'
1060: D205 Blank line missing between one-line summary and description
1086:9: E303 too many blank lines (2)
1100:5: E303 too many blank lines (2)
1103:1: E302 expected 2 blank lines, found 1
1103: D401 First line should be imperative: 'Return', not 'Returns'
1117:5: F841 local variable '_' is assigned to but never used
1120:12: E127 continuation line over-indented for visual indent
1129:16: E126 continuation line over-indented for hanging indent
1163: D401 First line should be imperative: 'Return', not 'Returns'
1163: D400 First line should end with '.', not 's'
1183:16: E126 continuation line over-indented for hanging indent
1190:1: E302 expected 2 blank lines, found 1
1190: D401 First line should be imperative: 'Return', not 'Returns'
1190: D400 First line should end with '.', not 'e'
1222:13: E303 too many blank lines (2)
1236: D401 First line should be imperative: 'Return', not 'Returns'
1270:16: E127 continuation line over-indented for visual indent
1280:31: E126 continuation line over-indented for hanging indent
1319:17: E126 continuation line over-indented for hanging indent
1326:1: E302 expected 2 blank lines, found 1
1326: D401 First line should be imperative: 'Return', not 'Returns'
1326: D400 First line should end with '.', not 'e'
1370:1: E302 expected 2 blank lines, found 1
1370: D401 First line should be imperative: 'Return', not 'Returns'
1370: D202 No blank lines allowed *after* function docstring, found 1
1497:1: E302 expected 2 blank lines, found 1
1497: D401 First line should be imperative: 'Return', not 'Returns'
1497: D202 No blank lines allowed *after* function docstring, found 1
1524:17: E225 missing whitespace around operator
1592:1: E302 expected 2 blank lines, found 1
1592: D401 First line should be imperative: 'Return', not 'Returns'
1592: D400 First line should end with '.', not 't'
1636:28: E261 at least two spaces before inline comment
1636:29: E262 inline comment should start with '# '
1691:1: E302 expected 2 blank lines, found 1
1691: D401 First line should be imperative: 'Return', not 'Returns'
1741:1: E302 expected 2 blank lines, found 1
1741: D401 First line should be imperative: 'Return', not 'Returns'
1741: D400 First line should end with '.', not 'y'
1782:1: E302 expected 2 blank lines, found 1
1782: D401 First line should be imperative: 'Return', not 'Returns'
1782: D202 No blank lines allowed *after* function docstring, found 1
1782: D400 First line should end with '.', not '}'
1799:56: E225 missing whitespace around operator
1823:1: E302 expected 2 blank lines, found 1
1823: D401 First line should be imperative: 'Return', not 'Returns'
1823: D400 First line should end with '.', not 'e'
1852:26: F821 undefined name 'exc'
1854:22: F821 undefined name 'exc'
1857:1: E302 expected 2 blank lines, found 1
1857: D401 First line should be imperative: 'Return', not 'Returns'
1890:1: E302 expected 2 blank lines, found 1
1890: D401 First line should be imperative: 'Return', not 'Returns'
1934:1: E302 expected 2 blank lines, found 1
1945:1: E302 expected 2 blank lines, found 1
1945: D203 Expected 1 blank line *before* class docstring, found 0
1945: D204 Expected 1 blank line *after* class docstring, found 0
1945: D400 First line should end with '.', not 'n'
1945: D205 Blank line missing between one-line summary and description
1976:15: E261 at least two spaces before inline comment
1978: D401 First line should be imperative: 'Create', not 'Creates'
2010:31: E261 at least two spaces before inline comment
2034: D401 First line should be imperative: 'Return', not 'Returns'
2034: D400 First line should end with '.', not 'e'
2049: D401 First line should be imperative: 'Return', not 'Returns'
2049: D400 First line should end with '.', not 'd'
2072: D401 First line should be imperative: 'Return', not 'Returns'
2072: D400 First line should end with '.', not 'e'
2072: D205 Blank line missing between one-line summary and description
2110: D401 First line should be imperative: 'Return', not 'Returns'
2110: D202 No blank lines allowed *after* method docstring, found 1
2219:36: E127 continuation line over-indented for visual indent
2222: D401 First line should be imperative: 'Return', not 'Returns'
2279:33: E127 continuation line over-indented for visual indent
2302:37: E127 continuation line over-indented for visual indent
2366: D400 First line should end with '.', not 'r'
2366: D205 Blank line missing between one-line summary and description
2406: D401 First line should be imperative: 'Run', not 'Runs'
2406: D400 First line should end with '.', not 'k'