def clean_data(data):
    """
    The API returns the company results as a list for multiple results
    and a dictionary for just a single result. This requires unnecessary
    type checking everywhere else so just enforcing a list here is the
    simplest thing to do. It makes the result more consistent.
    """
    try:
        if not isinstance(data['companies']['company'], list):
            data['companies']['company'] = [data['companies']['company']]
    except KeyError:
        pass
    return data
