def METHOD_NAME(attachment):
    data = {
        '_type': 'attachment',
        'id': attachment.id,
        'download_url': attachment.absolute_download_url,
        'title': attachment.title,
        'description': attachment.description,
        'modified_dt': attachment.modified_dt.isoformat(),
        'type': attachment.type.name,
        'is_protected': attachment.is_protected
    }
    if attachment.type == AttachmentType.file:
        data['filename'] = attachment.file.filename
        data['content_type'] = attachment.file.content_type
        data['size'] = attachment.file.size
        data['checksum'] = attachment.file.md5
    elif attachment.type == AttachmentType.link:
        data['link_url'] = attachment.link_url
    return data