def combine_code(selfcode, to_add):
    """
    Combines two verb codes, part of the verb interaction framework


    Parameters
    ----------
    selfcode,to_add: ints
                     Upper and lower verb codes, respectively

    Returns
    -------
    combined value

    """

    if to_add < 0:
        return to_add + selfcode
    if selfcode >= 0x1000 and to_add >= 0x1000:
        return to_add  # If both verbs are high-level, take the lower nested one. I think this is what we want?
    if to_add >= selfcode:
        return to_add

    return selfcode + to_add