title: Implement python decorator for passing down the function to another function
body: <p>I want to design a <code>python decorator</code> that takes a function which is decorated and passes it down to another function. Here is code explanation of what I am trying to do:</p>
  <pre><code>def run_decorator(run_batch):                                                                                                
      # inner function can access the outer local                                                                            
      # functions like in this case &quot;func&quot;                                                                                   
      def check(command_to_run):                                                                                             
          @functools.wraps(command_to_run)                                                                                             
          def wrapper(*args, **kwargs):
              batch_json_path = kwargs['batch_json_path']                                                                    
              batch_name = kwargs['batch_name']                                                                              
              folder_path = kwargs['folder_path']                                                                            
              if batch_json_path is not None:                                                                                
                  if batch_present(batch_json_path, batch_name):
                      run_batch(batch_json_path, command_to_run, batch_name)
           return wrapper
      return check
  
  def run_batch(batch_abs_path, command_to_run, batch_name=None):
      with open(batch_abs_path) as json_file:
          variant = ...
          tag_data = ...
          command_to_run(variant, batch_name, tag_data)
  
  @run_decorator(run_batch=run_batch)                                                                                                         
  def load_tag_for_variant(variant, batch_name, tag_data):
  </code></pre>
  <p>Is such behavior possible to achieve? Any suggestions would be greatly appreciated.</p>