docs: def _password_callback(c):
      """
      Converts given user function or string to C password callback
      function, passable to openssl.
  
      IF function is passed, it would be called upon reading or writing
      PEM format private key with one argument which is True if we are
      writing key and should verify passphrase and false if we are reading
  
      """
      if  c is None:
          return PW_CALLBACK_FUNC(0)
      if callable(c):
          if pyver ==2 :
              def __cb(buf, length, rwflag, userdata):
                  pwd = c(rwflag)
                  cnt = min(len(pwd),length)
                  memmove(buf,pwd, cnt)
                  return cnt
          else:        
              def __cb(buf, length, rwflag, userdata):
                  pwd = c(rwflag).encode("utf-8")
                  cnt = min(len(pwd),length)
                  memmove(buf,pwd, cnt)
                  return cnt
      else:
          if pyver > 2:
              c=c.encode("utf-8")
          def __cb(buf,length,rwflag,userdata):
              cnt=min(len(c),length)
              memmove(buf,c,cnt)
              return cnt
      return PW_CALLBACK_FUNC(__cb)