def get_snapshot(ec2, snapshot_name: str):
    """Returns a snapshot by its name."""
    res = ec2.describe_snapshots(Filters=[
        {'Name': 'tag:Name', 'Values': [snapshot_name]},
    ])

    if len(res['Snapshots']) > 1:
        raise ValueError('Several snapshots with Name=%s found.' % snapshot_name)

    snapshot = res['Snapshots'][0] if len(res['Snapshots']) else {}

    return snapshot