code: def os_function_mapper(map):
      
      def decorated(job, host, conn, *args, **kwargs):
          os = conn.guess_os()
          func = map.get(os)
          if func is None:
              raise Exception('No handler for %s found.' % os)
          return func(job, host, conn, *args, **kwargs)
      return decorated
docs: When called with an open connection, this function uses the
      conn.guess_os() function to guess the operating system
      of the connected host.
      It then uses the given map to look up a function name that corresponds
      to the operating system, and calls it. Example::
  
          def ios_xr(job, host, conn):
              pass # Do something.
  
          def junos(job, host, conn):
              pass # Do something else.
  
          def shell(job, host, conn):
              pass # Do something else.
  
          Exscript.util.start.quickrun('myhost', os_function_mapper(globals()))
  
      An exception is raised if a matching function is not found in the map.
  
      :type  conn: Exscript.protocols.Protocol
      :param conn: The open connection.
      :type  map: dict
      :param map: A dictionary mapping operating system name to a function.
      :type  args: list
      :param args: Passed on to the called function.
      :type  kwargs: dict
      :param kwargs: Passed on to the called function.
      :rtype:  object
      :return: The return value of the called function.