docs: def imm_array(q):
      '''
      imm_array(val) yields a version of val that is wrapped in numpy's ndarray class. If val is a
        read-only numpy array, then it is returned as-is; if it is not, then it is cast copied to a
        numpy array, duplicated, the read-only flag is set on the new object, and then it is returned.
      '''
      if is_quantity(q):
          m = mag(q)
          mm = imm_array(m)
          return q if mm is m else units.Quantity(mm, unit(q))
      elif not isinstance(q, np.ndarray) or q.flags['WRITEABLE']:
          q = np.array(q)
          q.setflags(write=False)
      return q