from io import StringIO


def print_snapshots(ec2, region):
    """
    Print a list of snapshots
    :param ec2: The boto3 ec2 client
    :param region: The region to search in
    :return: The nicely formatted list of snapshots to print
    """
    snapshots = ec2.describe_snapshots(OwnerIds=['self'])
    snapshot_list = snapshots['Snapshots']

    found = 0
    fp = StringIO()
    fp.write('\n')
    fp.write('Snapshots in %s\n' % region)
    fp.write('----------------------------------\n')
    for snapshot in snapshot_list:
        snapshot_id = snapshot['SnapshotId']
        snapshot_start_time = snapshot['StartTime'].strftime("%Y-%m-%d")
        fp.write(str(snapshot_id))
        fp.write('  ')
        fp.write(str(snapshot_start_time))
        fp.write('\n')
        found += 1
    sn_out = fp.getvalue()
    fp.close()
    if not found:
        return ""
    return sn_out