def seperate_warnings_by_location(warnings_data):
    """
    Warnings originate from multiple locations, this function takes in list of warning objects
    and separates them based on their filename location
    """

    # first create regex for each n file location
    warnings_locations = {
        ".*/python\d\.\d/site-packages/.*\.py": "python",  # noqa pylint: disable=W1401
        ".*/edx-platform/lms/.*\.py": "lms",  # noqa pylint: disable=W1401
        ".*/edx-platform/openedx/.*\.py": "openedx",  # noqa pylint: disable=W1401
        ".*/edx-platform/cms/.*\.py": "cms",  # noqa pylint: disable=W1401
        ".*/edx-platform/common/.*\.py": "common",  # noqa pylint: disable=W1401
    }

    # separate into locations flow:
    #  - iterate through each wanring_object, see if its filename matches any regex in warning locations.
    #  - If so, change high_location index on warnings_object to location name
    for warnings_object in warnings_data:
        warning_origin_located = False
        for key in warnings_locations:
            if (
                re.search(key, warnings_object[columns_index_dict["filename"]])
                is not None
            ):
                warnings_object[
                    columns_index_dict["high_location"]
                ] = warnings_locations[key]
                warning_origin_located = True
                break
        if not warning_origin_located:
            warnings_object[columns_index_dict["high_location"]] = "other"
    return warnings_data