code: def is_directory(path, use_sudo=False):
      
      result = single_line_stdout('if [[ -f {0} ]]; then echo 0; elif [[ -d {0} ]]; then echo 1; else echo -1; fi'.format(path), sudo=use_sudo, quiet=True)
      if result == '0':
          return False
      elif result == '1':
          return True
      else:
          return None
docs: Check if the remote path exists and is a directory.
  
      :param path: Remote path to check.
      :type path: unicode
      :param use_sudo: Use the `sudo` command.
      :type use_sudo: bool
      :return: `True` if the path exists and is a directory; `False` if it exists, but is a file; `None` if it does not
        exist.
      :rtype: bool or ``None``