def one_of_k_encoding_unk(x, allowable_set):
    """
    taken from https://github.com/thinng/GraphDTA

    function which one hot encodes x w.r.t. allowable_set with one bit reserved for elements not in allowable_set

    x:
        element from allowable_set
    allowable_set: list
        list of all known elements
    """
    if x not in allowable_set:
        x = allowable_set[-1]
    return list(map(lambda s: x == s, allowable_set))