# Path: google/resumable_media/common.py
# _SLEEP_RETRY_ERROR_MSG = (
#     "At most one of `max_cumulative_retry` and `max_retries` " "can be specified."
# )
# UPLOAD_CHUNK_SIZE = 262144  # 256 * 1024
# PERMANENT_REDIRECT = http.client.PERMANENT_REDIRECT  # type: ignore
# TOO_MANY_REQUESTS = http.client.TOO_MANY_REQUESTS
# MAX_SLEEP = 64.0
# MAX_CUMULATIVE_RETRY = 600.0
# RETRYABLE = (
#     http.client.TOO_MANY_REQUESTS,  # 429
#     http.client.REQUEST_TIMEOUT,  # 408
#     http.client.INTERNAL_SERVER_ERROR,  # 500
#     http.client.BAD_GATEWAY,  # 502
#     http.client.SERVICE_UNAVAILABLE,  # 503
#     http.client.GATEWAY_TIMEOUT,  # 504
# )
# class InvalidResponse(Exception):
# class DataCorruption(Exception):
# class RetryStrategy(object):
#     def __init__(self, response, *args):
#     def __init__(self, response, *args):
#     def __init__(
#         self,
#         max_sleep=MAX_SLEEP,
#         max_cumulative_retry=None,
#         max_retries=None,
#         initial_delay=1.0,
#         multiplier=2.0,
#     ):
#     def retry_allowed(self, total_sleep, num_retries):


import base64
import hashlib
import logging
import random
import warnings
        import google_crc32c  # type: ignore
            import crcmod  # type: ignore
from urllib.parse import parse_qs
from urllib.parse import urlencode
from urllib.parse import urlsplit
from urllib.parse import urlunsplit
from google.resumable_media import common
        callback()
        raise common.InvalidResponse(
            response, "Response headers must contain header", name
        )

    return headers[name]


def require_status_code(response, status_codes, get_status_code, callback=do_nothing):
    """Require a response has a status code among a list.

    Args:
        response (object): The HTTP response object.
        status_codes (tuple): The acceptable status codes.
        get_status_code (Callable[Any, int]): Helper to get a status code
            from a response.
        callback (Optional[Callable]): A callback that takes no arguments,
            to be executed when an exception is being raised.

    Returns:
        int: The status code.

    Raises:
        ~google.resumable_media.common.InvalidResponse: If the status code
            is not one of the values in ``status_codes``.
    """
    status_code = get_status_code(response)
    if status_code not in status_codes:
        if status_code not in common.RETRYABLE:
            callback()

# Path: google/resumable_media/common.py
# _SLEEP_RETRY_ERROR_MSG = (
#     "At most one of `max_cumulative_retry` and `max_retries` " "can be specified."
# )
# UPLOAD_CHUNK_SIZE = 262144  # 256 * 1024
# PERMANENT_REDIRECT = http.client.PERMANENT_REDIRECT  # type: ignore
# TOO_MANY_REQUESTS = http.client.TOO_MANY_REQUESTS
# MAX_SLEEP = 64.0
# MAX_CUMULATIVE_RETRY = 600.0
# RETRYABLE = (
#     http.client.TOO_MANY_REQUESTS,  # 429
#     http.client.REQUEST_TIMEOUT,  # 408
#     http.client.INTERNAL_SERVER_ERROR,  # 500
#     http.client.BAD_GATEWAY,  # 502
#     http.client.SERVICE_UNAVAILABLE,  # 503
#     http.client.GATEWAY_TIMEOUT,  # 504
# )
# class InvalidResponse(Exception):
# class DataCorruption(Exception):
# class RetryStrategy(object):
#     def __init__(self, response, *args):
#     def __init__(self, response, *args):
#     def __init__(
#         self,
#         max_sleep=MAX_SLEEP,
#         max_cumulative_retry=None,
#         max_retries=None,
#         initial_delay=1.0,
#         multiplier=2.0,
#     ):
#     def retry_allowed(self, total_sleep, num_retries):


# Path: google/resumable_media/_helpers.py
import base64
import hashlib
import logging
import random
import warnings
        import google_crc32c  # type: ignore
            import crcmod  # type: ignore
from urllib.parse import parse_qs
from urllib.parse import urlencode
from urllib.parse import urlsplit
from urllib.parse import urlunsplit
from google.resumable_media import common

        callback()
        raise common.InvalidResponse(
            response, "Response headers must contain header", name
        )

    return headers[name]


def require_status_code(response, status_codes, get_status_code, callback=do_nothing):
    """Require a response has a status code among a list.

    Args:
        response (object): The HTTP response object.
        status_codes (tuple): The acceptable status codes.
        get_status_code (Callable[Any, int]): Helper to get a status code
            from a response.
        callback (Optional[Callable]): A callback that takes no arguments,
            to be executed when an exception is being raised.

    Returns:
        int: The status code.

    Raises:
        ~google.resumable_media.common.InvalidResponse: If the status code
            is not one of the values in ``status_codes``.
    """
    status_code = get_status_code(response)
    if status_code not in status_codes:
        if status_code not in common.RETRYABLE:
            callback()

        raise common.InvalidResponse(