def convert(val, in_units, to=None):
    """Converts value in certain units into other units
    
    """
    from .managers import energy_units
    from .managers import Manager
    m = Manager()
    with energy_units(in_units):
        e = m.convert_energy_2_internal_u(val)
    if to is None:
        ne = m.convert_energy_2_current_u(e)
    else:
        with energy_units(to):
            ne = m.convert_energy_2_current_u(e)
    return ne
