
def object_in_list(hierarchy_node, list_of_hierarchy_nodes):
    '''

    Parameters
    ----------
    hierarchy_node
    list_of_hierarchy_nodes

    Returns
    -------

    '''
    for node in list_of_hierarchy_nodes:
        print(node.RefId(), hierarchy_node.getSimModelObject().RefId())
        return node.RefId() == hierarchy_node.getSimModelObject().RefId()


def object_in_list(hierarchy_node, list_of_hierarchy_nodes):
    '''

    Parameters
    ----------
    hierarchy_node
    list_of_hierarchy_nodes

    Returns
    -------

    '''
    for node in list_of_hierarchy_nodes:
        print(node.RefId(), hierarchy_node.getSimModelObject().RefId())
        return node.RefId() == hierarchy_node.getSimModelObject().RefId()
    return False

return False was not part of the for loop