def _fortran_to_val(val):
    """
    Transform a Fortran value to a Python one.

    Args:
        val (str): The value to translate.

    Returns:
        A Python representation.

    """
    if val[0] == val[-1] == '"':  # A string
        return val[1:-1]

    if val == ".true.":
        return True
    if val == ".false.":
        return False

    # Assume a number
    try:
        return int(val)
    except ValueError:
        pass

    # Assume a float
    val = val.replace("d", "e").replace("D", "e")
    try:
        return float(val)
    except ValueError:
        pass

    raise TypeError("Unable to parse: " + val)