def get_parameter_value(fp, name):
    """Get the value for a parameter in a parameter file.

    The entire parameter file is searched to find the given parameter and
    returned as a string. If the parameter is not found, then a ValueError is
    raised.

    Parameters
    ----------
    fp: str
        The path to the parameter file
    name: str
        The name of the parameter

    Returns
    -------
    value: str
        The value of the parameter
    """

    if fp.find(".pf") == -1:
        raise IOError(f"provided file path {fp} is not a .pf parameter file")

    with open(fp, "r") as f:
        lines = f.readlines()

    value = None

    for line in lines:
        if line.find(name) != -1:
            split = line.split()
            if len(split) != 2:
                raise IndexError(f"invalid syntax for {name} in parameter file {fp}")
            return split[-1]

    if value is None:
        raise ValueError(f"parameter {name} was not found in {fp}")

    return value