def strip_modified_terminal(v):
    """Extract core Terminal from a modified terminal or return None."""
    while not v._ufl_is_terminal_:
        if v._ufl_is_terminal_modifier_:
            v = v.ufl_operands[0]
        else:
            return None
    return v
