code: def numpy_str(arr, strvals=False, precision=None, pr=None,
                force_dtype=False,
                with_dtype=None, suppress_small=None, max_line_width=None,
                threshold=None, **kwargs):
      itemsep = kwargs.get('itemsep', ' ')
      newlines = kwargs.pop('nl', kwargs.pop('newlines', 1))
      data = arr
      separator = ',' + itemsep
      if strvals:
          prefix = ''
          suffix = ''
      else:
          modname = type(data).__module__
          np_nice = 'np'
          modname = re.sub('\\bnumpy\\b', np_nice, modname)
          modname = re.sub('\\bma.core\\b', 'ma', modname)
          class_name = type(data).__name__
          if class_name == 'ndarray':
              class_name = 'array'
          prefix = modname + '.' + class_name + '('
          if with_dtype:
              dtype_repr = data.dtype.name
              suffix = ',{}dtype={}.{})'.format(itemsep, np_nice, dtype_repr)
          else:
              suffix = ')'
      if not strvals and data.size == 0 and data.shape != (0,):
          prefix = modname + '.empty('
          body = repr(tuple(map(int, data.shape)))
      else:
          body = np.array2string(data, precision=precision,
                                 separator=separator,
                                 suppress_small=suppress_small,
                                 prefix=prefix,
                                 max_line_width=max_line_width)
      if not newlines:
          body = re.sub('\n *', '', body)
      formatted = prefix + body + suffix
      return formatted