def lookup(k, xs):
    """
    lookup k in a list l, which can also have pencilled entries. A
    pencilled entry is a list of possible values a cell might contain.
    """
    for x in xs:
        if isinstance(x, list):  # pencilled entry
            if k in x:
                return True
        elif x == k:
            return True
    return False