def endowment_effect(mkt_val, ref_val, time_held, scale_factor):
    """
    A simple endowment effect calculation method.

    Given an item with a market value, reference value (i.e, value item was
    purchased at), the amount of time it has been held, and a scale factor,
    return the price accounting for a simple endowment effect.

    endowment_effect =
    (mkt_val > ref_val ? mkt_val : ref_val) + time_held * scale_factor
    """

    endowment_effect = mkt_val if mkt_val > ref_val else ref_val
    endowment_effect += time_held * scale_factor
    return endowment_effect