@classmethod
def coerce(cls, key, value) ->'Attachment':
    """
        Converts plain dictionary to instance of this class.

        .. seealso:: :meth:`sqlalchemy.ext.mutable.MutableDict.coerce`

        """
    if value is None or isinstance(value, (cls, dict)):
        return super().coerce(key, value)
    if cls.__auto_coercion__:
        if not isinstance(value, (tuple, list)):
            value = value,
        return cls.create_from(*value)
    raise TypeError(
        "Value type must be subclass of % s or a tuple(file, mime, [filename]), but it's: %s"
         % (cls, type(value)))
