def _loop_exits_early(loop):
 loop_nodes = (astroid.For, astroid.While)
 for child in loop.body:
  if isinstance(child, loop_nodes):
   for orelse in (child.orelse or ()):
    for _ in orelse.nodes_of_class(astroid.Break, skip_klass=loop_nodes):
     return True
   continue
  for _ in child.nodes_of_class(astroid.Break, skip_klass=loop_nodes):
   return True
 return False

def _loop_exits_early ( loop ) : loop_nodes = ( astroid . For , astroid . While ) for child in loop . body : if isinstance ( child , loop_nodes ) : for orelse in ( child . orelse or ( ) ) : for _ in orelse . nodes_of_class ( astroid . Break , skip_klass = loop_nodes ) : return True continue for _ in child . nodes_of_class ( astroid . Break , skip_klass = loop_nodes ) : return True return False
returns true if a loop has a break statement in its body .