def set_default_retries(*args, **kwargs):
    """
    This function installs a default retry mechanism to be used in requests
    calls. The arguments are those of urllib3's `Retry` object (see
    http://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html#urllib3.util.retry.Retry).

    Examples:

        # use 3 retries, for default conditions only (network errors/timeouts)
        set_default_retries(total=3)
        set_default_retries(3)  # total can be given as a positional argument

        # use 5 retries, and add 429 and 503 responses to the list of
        # retryable conditions
        set_default_retries(5, status_forcelist=[429, 503])

        # use 5 retries with an exponential backoff factor of 1
        set_default_retries(5, backoff_factor=1)
    """
    global DEFAULT_RETRY_ARGS
    DEFAULT_RETRY_ARGS = kwargs
    if len(args) > 1:
        ValueError('too many arguments')
    elif len(args) == 1:
        DEFAULT_RETRY_ARGS['total'] = args[0]