def getUnitRegistry(length="meter", time="second", substance="item", volume=None, other=()):
    """Return a pint.UnitRegistry made compatible with ecell4.

    Parameters
    ----------
    length : str, optional
        A default unit for '[length]'. 'meter' is its default.
    time : str, optional
        A default unit for '[time]'. 'second' is its default.
    substance : str, optional
        A default unit for '[substance]' (the number of molecules). 'item' is its default.
    volume : str, optional
        A default unit for '[volume]'. Its default is None, thus '[length]**3'.
    other : tuple, optional
        A list of user-defined default units other than the above.

    Returns
    -------
    ureg : pint.UnitRegistry

    """
    ureg = pint.UnitRegistry()
    ureg.define('item = mole / (avogadro_number * 1 mole)')

    try:
        pint.molar
    # except UndefinedUnitError:
    except AttributeError:
        # https://github.com/hgrecco/pint/blob/master/pint/default_en.txt#L75-L77
        ureg.define('[concentration] = [substance] / [volume]')
        ureg.define('molar = mol / (1e-3 * m ** 3) = M')

    base_units = [unit for unit in (length, time, substance, volume) if unit is not None]
    base_units.extend(other)
    _ = ureg.System.from_lines(
        ["@system local using international"] + base_units,
        ureg.get_base_units)
    ureg.default_system = 'local'

    wrap_quantity(ureg.Quantity)

    pint.set_application_registry(ureg)  # for pickling
    return ureg
Return a pint.UnitRegistry made compatible with ecell4.

    Parameters
    ----------
    length : str, optional
        A default unit for '[length]'. 'meter' is its default.
    time : str, optional
        A default unit for '[time]'. 'second' is its default.
    substance : str, optional
        A default unit for '[substance]' (the number of molecules). 'item' is its default.
    volume : str, optional
        A default unit for '[volume]'. Its default is None, thus '[length]**3'.
    other : tuple, optional
        A list of user-defined default units other than the above.

    Returns
    -------
    ureg : pint.UnitRegistry