def index_from_location(
        response: Response,
        project: Project,
        location: typing.Union[str, int] = None,
        default: int = None
) -> int:
    """

    :param response:
    :param project:
    :param location:
    :param default:
    :return:
    """

    if location is None:
        return default

    if isinstance(location, (int, float)):
        return int(location)

    if isinstance(location, str):
        location = location.strip('"')

        try:
            location = int(location)
            return None if location < 0 else location
        except Exception:
            index = project.index_of_step(location)
            return default if index is None else (index + 1)

    return default
def index_from_location ( response : Response , project : Project , location : typing . Union [ str , int ] = None , default : int = None ) -> int : if location is None : return default if isinstance ( location , ( int , float ) ) : return int ( location ) if isinstance ( location , str ) : location = location . strip ( '"' ) try : location = int ( location ) return None if location < 0 else location except Exception : index = project . index_of_step ( location ) return default if index is None else ( index + 1 ) return default
:param response:
    :param project:
    :param location:
    :param default:
    :return: