code: def map_or_apply(function, param):
      
      try:
          if isinstance(param, list):
              return [next(iter(function(i))) for i in param]
          else:
              return next(iter(function(param)))
      except StopIteration:
          return None
docs: Map the function on ``param``, or apply it, depending whether ``param`` \
              is a list or an item.
  
      :param function: The function to apply.
      :param param: The parameter to feed the function with (list or item).
      :returns: The computed value or ``None``.