code: def _to_unicode(s):
      
      try:
          return s.encode('ascii')
      except (UnicodeError, AttributeError):
          try:
              return s.decode('utf-8')
          except UnicodeError:
              return s
docs: decode a string as ascii or utf8 if possible (as required by the sftp
      protocol).  if neither works, just return a byte string because the server
      probably doesn't know the filename's encoding.