'Convert Media to dict.'

def convert(self):

    result = {}
    for k in self._keys:
        value = getattr(self, k, None)
        if (isinstance(value, list) and value and isinstance(value[0], Media)):
            value = [x.convert() for x in value]
        result[k] = value
    return result
