'Receives the value stored in the SQL backend and return the
value to be stored in the model.
For fixed fields the type of `value` is determined by the column
type affinity given in the `sql` property and the SQL to Python
mapping of the database adapter. For more information see:
http://www.sqlite.org/datatype3.html
https://docs.python.org/2/library/sqlite3.html#sqlite-and-python-types
Flexible fields have the type affinity `TEXT`. This means the
`sql_value` is either a `buffer`/`memoryview` or a `unicode` object`
and the method must handle these in addition.'

def from_sql(self, sql_value):

    if isinstance(sql_value, buffer):
        sql_value = bytes(sql_value).decode('utf-8', 'ignore')
    if isinstance(sql_value, six.text_type):
        return self.parse(sql_value)
    else:
        return self.normalize(sql_value)
