The first function very often is used in Python for decorating other functions. It is a "proxy function".
decorator
A function returning another function, usually applied as a function transformation using the @wrapper syntax. Common examples for decorators are classmethod() and staticmethod().
The decorator syntax is merely syntactic sugar, the following two function definitions are semantically equivalent:
...
f = staticmethod(f)
@staticmethod
def f(...):
...
The same concept exists for classes, but is less commonly used there. See the documentation for function definitions and class definitions for more about decorators.
That's very helpful for building clean code.
More info at https://docs.python.org/3/glossary.html#term-decorator
The second one is just assigning a function to somewhere, variable, object or class property and etc. Usually is used in Monkey Patching
A monkey patch is a way for a program to extend or modify supporting system software locally (affecting only the running instance of the program).
The definition of the term varies depending upon the community using it. In Ruby, Python, and many other dynamic programming languages, the term monkey patch only refers to dynamic modifications of a class or module at runtime, motivated by the intent to patch existing third-party code as a workaround to a bug or feature which does not act as desired. Other forms of modifying classes at runtime have different names, based on their different intents. For example, in Zope and Plone, security patches are often delivered using dynamic class modification, but they are called hotfixes
More info at https://en.wikipedia.org/wiki/Monkey_patch