docs: def _needs_base64_encoding(self, attr_type, attr_value):
          """Return True if attr_value has to be base-64 encoded.
  
          This is the case because of special chars or because attr_type is in
          self._base64_attrs
          """
          return attr_type.lower() in self._base64_attrs or \
              isinstance(attr_value, bytes) or \
              UNSAFE_STRING_RE.search(attr_value) is not None