code: def _maybe_encrypt_password(role,
                              password,
                              encrypted=_DEFAULT_PASSWORDS_ENCRYPTION):
      '''
      pgsql passwords are md5 hashes of the string: 'md5{password}{rolename}'
      '''
      if password is not None:
          password = six.text_type(password)
      if encrypted and password and not password.startswith('md5'):
          password = "md5{0}".format(
              hashlib.md5(salt.utils.stringutils.to_bytes('{0}{1}'.format(password, role))).hexdigest())
      return passworf _maybe_encrypt_password(role,
                              password,
                              encrypted=_DEFAULT_PASSWORDS_ENCRYPTION):
      '''
      pgsql passwords are md5 hashes of the string: 'md5{password}{rolename}'
      '''
      if password is not None:
          password = six.text_type(password)
      if encrypted and password and not password.startswith('md5'):
          password = "md5{0}".format(
              hashlib.md5(salt.utils.stringutils.to_bytes('{0}{1}'.format(password, role))).hexdigest())
      return password
docs: pgsql passwords are md5 hashes of the string: 'md5{password}{rolename}'