docs: def quant(val, u=Ellipsis):
      '''
      quant(scalar) yields a dimensionless quantity with the magnitude given by scalar.
      quant(q) yields q for any quantity q; if q is not part of the pimms units registry, then a
        version of q registered to pimms.units is yielded. Note that q is a quantity if
        pimms.is_quantity(q) is True.
      quant(x, u) yields the given scalar or quantity x converted to the given unit u; if x is a
        scalar or a dimensionless quantity, then the unit u is given to the new quantity with no
        conversion; otherwise, x must be a quantity whose unit can be converted into the unit u.
      '''
      if is_quantity(val):
          if isinstance(val, tuple) or val._REGISTRY is not units:
              val = units.Quantity(mag(val), unit(val))
          return val if u is Ellipsis or u is None else val.to(unit(u))
      else:
          return units.Quantity(val, units.dimensionless if u is Ellipsis or u is None else unit(u))