import json


def process_event(event):
    """Checks if the event is valid (comes from OneTrigger) and returns the
    file path"""
    try:
        event = json.loads(event)
    except Exception as e:
        raise Exception(f'Invalid event format: {e}')
    if ('Records' in event and
            event['Records'] and
            'eventSource' in event['Records'][0] and
            event['Records'][0]['eventSource'] == 'OneTrigger'):
        return event['Key']
    else:
        raise Exception('Event is not generated by OneTrigger')