def is_valid_node(map, node):
    """
    check if node is inside map and not on any obstacle
    """
    inside_map_cond = node.position[0] >= 0 and \
                      node.position[1] >= 0 and \
                      node.position[0] < map.shape[0] and \
                      node.position[1] < map.shape[1]
    if not inside_map_cond:
        return False
    if map[node.position[0], node.position[1]] == 1:
        return False
    return True