def _conv_type(s, func):
    """Generic converter, to change strings to other types.

    Args:
        s (str): String that represents another type.
        func (function): Function to convert s, should take a singe parameter
            eg: int(), float()

    Returns:
        The type of func, otherwise str

    """
    if func is not None:
        try:
            return func(s)
        except ValueError:
            return s
    return s