code: def convert_to_string(ndarr):
      
      with contextlib.closing(BytesIO()) as bytesio:
          _internal_write(bytesio, ndarr)
          return bytesio.getvalue()
docs: Writes the contents of the numpy.ndarray ndarr to bytes in IDX format and
      returns it.