import csv
import re


def get_keys_from_file(file):
    """
    Reads a file and creates a list of dictionaries.
    :param file: Filename relative to project root.
    :return: lkeys - a list of dictionaries
        [{
            Key: '00484545-2000-4111-9000-611111111111',
            Region: 'us-east-1'
        },
        {
            Key: '00484545-2000-4111-9000-622222222222',
            Region: 'us-east-1'
        }]
    """
    lkeys = []
    regex = '[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-4[0-9A-Za-z]{3}-[89ABab][0-9A-Za-z]{3}-[0-9A-Za-z]{12}'
    with open(file, newline='') as csvfile:
        reader = csv.reader(csvfile, delimiter=' ', quotechar='|')
        for row in reader:
            if len(row) > 3 and re.search(regex, row[2]):
                lkeys.append({'Key': row[2], 'Region': row[0]})
        return lkeys