def METHOD_NAME(quantity, units_in, units_out, inplace=False):
    """Convert a numerical quantity between unit systems.
    Parameters
    ----------
    quantity : {number, np.ndarray, openmm.unit.Quantity}
        quantity can either be a unitted quantity -- i.e. instance of
        openmm.unit.Quantity, or just a bare number or numpy array
    units_in : str
        If you supply a quantity that's not a openmm.unit.Quantity, you should
        tell me what units it is in. If you don't, i'm just going to echo you
        back your quantity without doing any unit checking.
    units_out : str
        A string description of the units you want out. This should look
        like "nanometers/picosecond" or "nanometers**3" or whatever
    inplace : bool
        Attempt to do the transformation inplace, by mutating the `quantity`
        argument and avoiding a copy. This is only possible if `quantity` is a
        writable numpy array.
    Returns
    -------
    rquantity : {number, np.ndarray}
        The resulting quantity, in the new unit system. If the function was
        called with `inplace=True` and `quantity` was a writable numpy array,
        `rquantity` will alias the same memory as the input `quantity`, which
        will have been changed inplace. Otherwise, if a copy was required,
        `rquantity` will point to new memory.
    Examples
    --------
    >>> in_units_of(1, 'meter**2/second', 'nanometers**2/picosecond')
    1000000.0
    """
    if quantity is None:
        return quantity
    if ('openmm.unit' in sys.modules and
        isinstance(quantity, openmm_unit.Quantity)):
        units_in = quantity.unit
        units_out = _str_to_unit(units_out, openmm=True)
        quantity = quantity._value
    elif isinstance(quantity, Quantity):
        units_in = quantity.unit
        units_out = _str_to_unit(units_out)
        quantity = quantity._value
    else:
        if units_in is None:
            return quantity
        units_in = _str_to_unit(units_in)
        units_out = _str_to_unit(units_out)
    if not units_in.is_compatible(units_out):
        raise TypeError('Unit "%s" is not compatible with Unit "%s".' % (units_in, units_out))
    factor = units_in.conversion_factor_to(units_out)
    if inplace and (isinstance(quantity, np.ndarray) and quantity.flags['WRITEABLE']):
        quantity *= factor
        return quantity
    return quantity * factor