title: Python __gettattr__ returning function
body: <p>I am currently trying to read python codebase - I picked up the <a href="https://github.com/kennethreitz/crayons" rel="nofollow noreferrer">crayons</a> by Kenneth Reitz as it seems very well written and rather simple, but I am having issues understanding the meaning of the following method (<a href="https://github.com/kennethreitz/crayons/blob/master/crayons.py#L52" rel="nofollow noreferrer">code ref</a>):</p>
  
  <pre><code>...
  def __getattr__(self, att):
      def func_help(*args, **kwargs):
          result = getattr(self.s, att)(*args, **kwargs)
          try:
              is_result_string = isinstance(result, basestring)
          except NameError:
              is_result_string = isinstance(result, str)
          if is_result_string:
              return self._new(result)
          elif isinstance(result, list):
              return [self._new(x) for x in result]
          else:
              return result
      return func_help
  ...
  </code></pre>
  
  <p>While I have pretty good idea what the magic method <code>__getattr__</code> does, I kind of struggle seeing the point of returning the function (or how would I use it for that matter).</p>