def METHOD_NAME(val, current_unit, destination_unit):
    """Convert from one unit to another.
    If current_unit and/or destination_unit are None, input is returned.
    Parameters
    ----------
    val : number
        Number to convert.
    current_unit : string
        Current unit.
    destination_unit : string
        Destination unit.
    Returns
    -------
    number
        Converted value.
    """
    if (current_unit is None) and (destination_unit is None):
        return val
    if (current_unit is None) or (destination_unit is None):
        warnings.warn(
            f"conversion {current_unit} to {destination_unit} not valid: returning input"
        )
        return val
    try:
        val = ureg.Quantity(val, current_unit).to(destination_unit).magnitude
    except ZeroDivisionError:
        warnings.warn(
            f"conversion {current_unit} to {destination_unit} resulted in ZeroDivisionError: returning inf"
        )
        return float("inf")
    return val