code: def normalize_attr_strings(a: np.ndarray) -> np.ndarray:
  	
  	if np.issubdtype(a.dtype, np.object_):
  		# if np.all([type(x) is str for x in a]) or np.all([type(x) is np.str_ for x in a]) or np.all([type(x) is np.unicode_ for x in a]):
  		if np.all([(type(x) is str or type(x) is np.str_ or type(x) is np.unicode_) for x in a]):
  			return np.array([x.encode('ascii', 'xmlcharrefreplace') for x in a])
  		elif np.all([type(x) is np.string_ for x in a]) or np.all([type(x) is np.bytes_ for x in a]):
  			return a.astype("string_")
  		else:
  			logging.debug(f"Attribute contains mixed object types ({np.unique([str(type(x)) for x in a])}); casting all to string")
  			return np.array([str(x) for x in a], dtype="string_")
  	elif np.issubdtype(a.dtype, np.string_) or np.issubdtype(a.dtype, np.object_):
  		return a
  	elif np.issubdtype(a.dtype, np.str_) or np.issubdtype(a.dtype, np.unicode_):
  		return np.array([x.encode('ascii', 'xmlcharrefreplace') for x in a])
  	else:
  		raise ValueError("String values must be object, ascii or unicode.")
docs: Take an np.ndarray of all kinds of string-like elements, and return an array of ascii (np.string_) objects