I understand the purpose of `functools.wraps` - to carry over attributes like `__doc__`, `__name__`, etc. But I'm struggling to explain why the below is happening. I have this decorator function in Python:

```
from functools import update_wrapper
class Environment:
    ...

def requires_environment(function: Callable) -> Callable:
    def wrapped_function(*args, environment, **kwargs):
        if not isinstance(environment, Environment):
            raise TypeError("The environment keyword argument must be of type Environment.")
        kwargs["environment"] = environment
        return function(*args, **kwargs)
    update_wrapper(wrapped_function, function)
    return wrapped_function

```

Then I decorate a function with it:

```
@requires_environment
def function_with_args(arg1, arg2, environment):
   pass

```

When I do not provide an `environment` keyword to my `function_with_args`, I expect that the error message should say `TypeError: function_with_args()`:

```
function_with_args(1, 2, Environment.PROD)

```

I get 

```
TypeError: wrapped_function() missing 1 required keyword-only argument: 'environment'

```

Why is `wrapped_function` showing instead of `function_with_args`? If I print get rid of the syntactic sugar of the `@` decorator and print the function name, even after decoration, it is properly saying that the new wrapped function's name is `function_with_args`:

```
function_with_args = requires_environment(function_with_args)
print("After", function_with_args.__name__) # After function_with_args
function_with_args(1, 2, Environment.PROD)

```

Yet I still see my `wrapped_function` name in the `TypeError`. Why is this occuring?

Below is my complete reproducible example:

```
from time import perf_counter
from typing import Callable
from enum import Enum
from functools import update_wrapper

class Environment(Enum):
    PROD = "PROD"
    STAGING = "STAGING"
    DEV = "DEV"

def requires_environment(function: Callable) -> Callable:
    def wrapped_function(*args, **kwargs):
        if "environment" not in kwargs:
            raise TypeError(f"{function.__name__}() missing 1 required keyword-only argument: 'environment'")

        if not isinstance(kwargs['environment'], Environment):
            raise TypeError("The environment keyword argument must be of type Environment.")

        return function(*args, **kwargs)

    update_wrapper(wrapped_function, function)

    return wrapped_function

@requires_environment
def function_with_args(arg1, arg2, environment):
    print(f"Inside function {function_with_args.__name__}")
    print(f"Docstrings: {function_with_args.__doc__}")

function_with_args(1, 2, Environment.PROD)

```