code: def convert_attribute_to_string(value):
      
      if value is None:
          return value
      elif (sys.hexversion >= 0x03000000 and isinstance(value, str)) \
              or (sys.hexversion < 0x03000000 \
              and isinstance(value, unicode)):
          return value
      elif isinstance(value, bytes):
          return value.decode()
      elif isinstance(value, np.unicode_):
          return str(value)
      elif isinstance(value, np.bytes_):
          return value.decode()
      else:
          return None
docs: Convert an attribute value to a string.
  
      Converts the attribute value to a string if possible (get ``None``
      if isn't a string type).
  
      .. versionadded:: 0.2
  
      Parameters
      ----------
      value :
          The Attribute value.
  
      Returns
      -------
      s : str or None
          The ``str`` value of the attribute if the conversion is
          possible, or ``None`` if not.