code: def _inherit_attr(klass, attr, default, cp):
      
      if attr not in klass.__dict__:
          if hasattr(klass, attr):
              value = cp(getattr(klass, attr))
          else:
              value = default
          setattr(klass, attr, value)
docs: Inherit the attribute from the base class
  
      Copy `attr` from base class (otherwise use `default`). Copying is done using
      the passed `cp` function.
  
      The motivation behind writing this function is to allow inheritance among
      Cmdln classes where base classes set 'common' options using the
      `@cmdln.option` decorator. To ensure this, we must not write to the base
      class's options when handling the derived class.