def measure_model(element, state, observation, config):
    """
    Measurement model describing the likelihood function p(observation | state).

    :param element: a Tree object from the LatticeForest simulator.
    :param state: state value, from Tree state space, to determine probability.
    :param observation: observation value, from Tree state space, to determine probability.
    :param config: Config class object containing the probability of measuring the correct state,
    p(observation | state) when observation == state.

    :return: the probability value p(observation | state).
    """
    measure_correct = config.measure_correct
    measure_wrong = (1/(len(element.state_space)-1))*(1-measure_correct)

    if state != observation:
        return measure_wrong
    elif state == observation:
        return measure_correct