def mediafile_data(mediafile):
    """Return json serializable data for the mediafile."""
    if mediafile is None:
        return None
    return {'url': mediafile.file.url, 'type': mediafile.type, 'created':
        mediafile.created, 'copyright': mediafile.copyright, 'file_size':
        mediafile.file_size}
