def get_account_data()

in src/utils/data.py [0:0]


def get_account_data(s3_url: str):
    """Gets a XLS from the provided s3_url and returns a dict of account info. """

    if 's3://' not in s3_url:
        raise ValueError(f's3_url was set to {s3_url} and did not include s3://')

    s3_path = s3_url.split('/', 3)  # Max split of 3 means object key will be a single item even if it has "/"
    bucket_name = s3_path[2]
    object_key = s3_path[3]

    if not (bool(bucket_name) and bool(object_key)):
        raise ValueError(f'bucket_name or object_key is either None or Empty')

    if not re.search(r'^\S+.xls$', object_key):
        raise Exception("File format not supported, Only '.xsl' format is supported as of now.")

    xls = get_s3_data(bucket_name, object_key)
    account_data = process_xls(xls)
    return account_data