(quantity)
return sorted(rv, key=len)
Return a list of matching units names.
    if quantity is a string -- units containing the string `quantity`
    if quantity is a unit -- units having matching base units

    Examples
    ========

    >>> from sympy.physics import units as u
    >>> u.find_unit('charge')
    ['charge']
    >>> u.find_unit(u.charge)
    ['C', 'charge', 'coulomb', 'coulombs']
    >>> u.find_unit('volt')
    ['volt', 'volts', 'voltage']
    >>> u.find_unit(u.inch**3)[:5]
    ['l', 'cl', 'dl', 'ml', 'liter']
Return a list of matching units names.
    if quantity is a string -- units containing the string `quantity`
    if quantity is a unit -- units having matching base units
Return a list of matching units names . if quantity is a string -- units containing the string quantity if quantity is a unit -- units having matching base units
def find_unit(quantity):
    """
    Return a list of matching units names.
    if quantity is a string -- units containing the string `quantity`
    if quantity is a unit -- units having matching base units

    Examples
    ========

    >>> from sympy.physics import units as u
    >>> u.find_unit('charge')
    ['charge']
    >>> u.find_unit(u.charge)
    ['C', 'charge', 'coulomb', 'coulombs']
    >>> u.find_unit('volt')
    ['volt', 'volts', 'voltage']
    >>> u.find_unit(u.inch**3)[:5]
    ['l', 'cl', 'dl', 'ml', 'liter']
    """
    import sympy.physics.units as u
    rv = []
    if isinstance(quantity, str):
        rv = [i for i in dir(u) if quantity in i]
    else:
        units = quantity.as_coeff_Mul()[1]
        for i in dir(u):
            try:
                if units == eval('u.' + i).as_coeff_Mul()[1]:
                    rv.append(str(i))
            except:
                pass
    return sorted(rv, key=len)
def find_unit ( quantity ) : import sympy . physics . units as u rv = [ ] if isinstance ( quantity , str ) : rv = [ i for i in dir ( u ) if quantity in i ] else : units = quantity . as_coeff_Mul ( ) [ 1 ] for i in dir ( u ) : try : if units == eval ( 'u.' + i ) . as_coeff_Mul ( ) [ 1 ] : rv . append ( str ( i ) ) except : pass return sorted ( rv , key = len )