docs: def generate_accepted_kwargs(function, *named_arguments):
      """Dynamically creates a function that when called with dictionary of arguments will produce a kwarg that's
         compatible with the supplied function
      """
      if hasattr(function, '__code__') and takes_kwargs(function):
          function_takes_kwargs = True
          function_takes_arguments = []
      else:
          function_takes_kwargs = False
          function_takes_arguments = takes_arguments(function, *named_arguments)
  
      def accepted_kwargs(kwargs):
          if function_takes_kwargs:
              return kwargs
          elif function_takes_arguments:
              return {key: value for key, value in kwargs.items() if key in function_takes_arguments}
          return {}
      return accepted_kwargs