def make_constants(builtin_only=False, stoplist=None, verbose=None):
    """Return a decorator for optimizing global references.

    Replaces global references with their currently defined values.
    If not defined, the dynamic (runtime) global lookup is left undisturbed.
    If builtin_only is True, then only builtins are optimized.
    Variable names in the stoplist are also left undisturbed.
    Also, folds constant attr lookups and tuples of constants.
    If verbose is True, prints each substitution as is occurs.

    :param bool builtin_only: only transform builtin objects.
    :param list stoplist: attribute names to not transform.
    :param function verbose: logger function which takes in parameter a message
    """

    if stoplist is None:
        stoplist = []

    if isinstance(builtin_only, type(make_constants)):
        raise ValueError("The bind_constants decorator must have arguments.")

    return lambda func: _make_constants(func, builtin_only, stoplist, verbose)
Return a decorator for optimizing global references.

    Replaces global references with their currently defined values.
    If not defined, the dynamic (runtime) global lookup is left undisturbed.
    If builtin_only is True, then only builtins are optimized.
    Variable names in the stoplist are also left undisturbed.
    Also, folds constant attr lookups and tuples of constants.
    If verbose is True, prints each substitution as is occurs.

    :param bool builtin_only: only transform builtin objects.
    :param list stoplist: attribute names to not transform.
    :param function verbose: logger function which takes in parameter a message