def create_attachment(payload):
    """
    Create a simple url-based attachment.
    """
    assert payload['type'] in ['image', 'video', 'file', 'audio'
        ], 'unsupported attachment type'
    assert 'url' in payload or 'attachment_id' in payload, 'unsupported attachment method: must contain url or attachment_id'
    if 'url' in payload:
        return {'type': payload['type'], 'payload': {'url': payload['url']}}
    elif 'attachment_id' in payload:
        return {'type': payload['type'], 'payload': {'attachment_id':
            payload['attachment_id']}}
