code: def suggest_localhost(func):
      '''Decorator: prompt user for value of env.host_string with default to
      'localhost' when env.host_string is empty.
  
      Modification of decorator function fabric.network.needs_host
      '''
      from fabric.network import handle_prompt_abort, to_dict
  
      @wraps(func)
      def host_prompting_wrapper(*args, **kwargs):
          while not env.get('host_string', False):
              handle_prompt_abort("the target host connection string")
              host_string = raw_input("No hosts found. Please specify "
                                      "host string for connection [localhost]: ")
              if host_string == '':
                  host_string = 'localhost'
              env.update(to_dict(host_string))
          return func(*args, **kwargs)
  
      host_prompting_wrapper.undecorated = func
  
      return host_prompting_wrappef suggest_localhost(func):
      '''Decorator: prompt user for value of env.host_string with default to
      'localhost' when env.host_string is empty.
  
      Modification of decorator function fabric.network.needs_host
      '''
      from fabric.network import handle_prompt_abort, to_dict
  
      @wraps(func)
      def host_prompting_wrapper(*args, **kwargs):
          while not env.get('host_string', False):
              handle_prompt_abort("the target host connection string")
              host_string = raw_input("No hosts found. Please specify "
                                      "host string for connection [localhost]: ")
              if host_string == '':
                  host_string = 'localhost'
              env.update(to_dict(host_string))
          return func(*args, **kwargs)
  
      host_prompting_wrapper.undecorated = func
  
      return host_prompting_wrapper
docs: Decorator: prompt user for value of env.host_string with default to
      'localhost' when env.host_string is empty.
  
      Modification of decorator function fabric.network.needs_host