code: def convert_errno(e):
          
          if e == errno.EACCES:
              # permission denied
              return SFTP_PERMISSION_DENIED
          elif (e == errno.ENOENT) or (e == errno.ENOTDIR):
              # no such file
              return SFTP_NO_SUCH_FILE
          else:
              return SFTP_FAILURE
docs: Convert an errno value (as from an ``OSError`` or ``IOError``) into a
          standard SFTP result code.  This is a convenience function for trapping
          exceptions in server code and returning an appropriate result.
  
          :param int e: an errno code, as from ``OSError.errno``.
          :return: an `int` SFTP error code like ``SFTP_NO_SUCH_FILE``.