docs: def make_password(password, encoding='BCRYPT'):
      """
      Make a password with PLAIN, SSHA or BCRYPT (default) encoding.
  
      >>> make_password('foo', encoding='PLAIN')
      '{PLAIN}foo'
      >>> make_password(u're-foo', encoding='SSHA')[:6]
      '{SSHA}'
      >>> make_password(u're-foo')[:8]
      '{BCRYPT}'
      >>> make_password('foo') == make_password('foo')
      False
      """
      if encoding not in ['PLAIN', 'SSHA', 'BCRYPT']:
          raise ValueError("Unknown encoding %s" % encoding)
      if encoding == 'PLAIN':
          if isinstance(password, str) and six.PY2:
              password = six.text_type(password, 'utf-8')
          return '{PLAIN}%s' % password
      elif encoding == 'SSHA':
          # SSHA is a modification of the SHA digest scheme with a salt
          # starting at byte 20 of the base64-encoded string.
          # Source: http://developer.netscape.com/docs/technote/ldap/pass_sha.html
          # This implementation is from Zope2's AccessControl.AuthEncoding.
  
          salt = ''
          for n in range(7):
              salt += chr(randrange(256))
          # b64encode accepts only bytes in Python 3, so salt also has to be encoded
          salt = salt.encode('utf-8') if six.PY3 else salt
          if isinstance(password, six.text_type):
              password = password.encode('utf-8')
          else:
              password = str(password)
          b64_encoded = b64encode(hashlib.sha1(password + salt).digest() + salt)
          b64_encoded = b64_encoded.decode('utf-8') if six.PY3 else b64_encoded
          return '{SSHA}%s' % b64_encoded
      elif encoding == 'BCRYPT':
          # BCRYPT is the recommended hash for secure passwords
          password_hashed = bcrypt.hashpw(
              password.encode('utf-8') if isinstance(password, six.text_type) else password,
              bcrypt.gensalt())
          if six.PY3:  # pragma: no cover
              password_hashed = password_hashed.decode('utf-8')
          return '{BCRYPT}%s' % password_hashed