parameters: (mask)
return_statement: return boundaries
docstring: return a list of (ind0, ind1) such that mask[ind0:ind1].all() is
      True and we cover all such regions
docstring_summary: return a list of (ind0, ind1) such that mask[ind0:ind1].all() is
      True and we cover all such regions
docstring_tokens: return a list of ( ind0 ind1 ) such that mask [ ind0 : ind1 ] . all () is True and we cover all such regions
function: def contiguous_regions(mask):
      """
      return a list of (ind0, ind1) such that mask[ind0:ind1].all() is
      True and we cover all such regions
      """
      in_region = None
      boundaries = []
      for i, val in enumerate(mask):
          if in_region is None and val:
              in_region = i
          elif in_region is not None and not val:
              boundaries.append((in_region, i))
              in_region = None
  
      if in_region is not None:
          boundaries.append((in_region, i+1))
      return boundaries
function_tokens: def contiguous_regions ( mask ) : in_region = None boundaries = [ ] for i , val in enumerate ( mask ) : if in_region is None and val : in_region = i elif in_region is not None and not val : boundaries . append ( ( in_region , i ) ) in_region = None if in_region is not None : boundaries . append ( ( in_region , i + 1 ) ) return boundaries