def _get_title_from_contents(meta_data):
 piece = meta_data[:]
 title = None
 for (i, line) in enumerate(piece):
  if (re_rst_title.findall(line) and (i > 0)):
   title = meta_data[(i - 1)].strip()
   break
  if (re_rst_title.findall(line) and (i >= 0) and re_rst_title.findall(meta_data[(i + 2)])):
   title = meta_data[(i + 1)].strip()
   break
  if re_md_title.findall(line):
   title = re_md_title.findall(line)[0]
   break
 return title

def _get_title_from_contents ( meta_data ) : piece = meta_data [ : ] title = None for ( i , line ) in enumerate ( piece ) : if ( re_rst_title . findall ( line ) and ( i > 0 ) ) : title = meta_data [ ( i - 1 ) ] . strip ( ) break if ( re_rst_title . findall ( line ) and ( i >= 0 ) and re_rst_title . findall ( meta_data [ ( i + 2 ) ] ) ) : title = meta_data [ ( i + 1 ) ] . strip ( ) break if re_md_title . findall ( line ) : title = re_md_title . findall ( line ) [ 0 ] break return title
extract title from file contents .