def get_index_of_first_statement(src_text):
 preprocessor_directive = u'\\s*#.*?$'
 pattern_text = preprocessor_directive
 pattern_text += (u'|' + multi_line_comment)
 pattern_text += (u'|' + single_line_comment)
 pattern_text += (u'|' + whitespace)
 pattern = re.compile(pattern_text, (re.M | re.S))
 match_iter = pattern.finditer(src_text)
 index = 0
 for match in match_iter:
  if (match.start() != index):
   break
  index = match.end()
 return index

def get_index_of_first_statement ( src_text ) : preprocessor_directive = u'\\s*#.*?$' pattern_text = preprocessor_directive pattern_text += ( u'|' + multi_line_comment ) pattern_text += ( u'|' + single_line_comment ) pattern_text += ( u'|' + whitespace ) pattern = re . compile ( pattern_text , ( re . M | re . S ) ) match_iter = pattern . finditer ( src_text ) index = 0 for match in match_iter : if ( match . start ( ) != index ) : break index = match . end ( ) return index
returns the index of the first character thats not whitespace .