def parse_api_response(response: requests.models.Response) -> dict:
    """
    Utility function which parses API json response using orjson.

    requests uses simplejson, but this version uses orjson which can be up to 50% faster and that
    is especially pronounced with larger response.
    """
    # Upstream implementation is available at
    # https://github.com/psf/requests/blob/master/requests/models.py#L876
    # NOTE: It's important that we manually decode response.content attribute before passing it to
    # orjson otherwise orjson will try to decode it and will be slower.

    # Inside tests content is not always bytes
    if isinstance(response.content, str):
        data = response.content
    else:
        data = response.content.decode("utf-8")

    data = orjson.loads(data)
    return data

    Utility function which parses API json response using orjson.

    requests uses simplejson, but this version uses orjson which can be up to 50% faster and that
    is especially pronounced with larger response.
    
st2client/st2client/models/core.py