def strip_leading_tabs(docs):
 lines = docs.splitlines()
 start = 0
 for line in lines:
  if (line != u''):
   break
  start += 1
 if start:
  lines = lines[start:]
 if (len(lines) > 1):
  start_line = 1
  ref_line = lines[start_line]
  while (not ref_line):
   start_line += 1
   if (start_line > len(lines)):
    break
   ref_line = lines[start_line]
  strip_left = (len(ref_line) - len(ref_line.lstrip()))
  if strip_left:
   docs = u'\n'.join(([lines[0]] + [l[strip_left:] for l in lines[1:]]))
 return docs

def strip_leading_tabs ( docs ) : lines = docs . splitlines ( ) start = 0 for line in lines : if ( line != u'' ) : break start += 1 if start : lines = lines [ start : ] if ( len ( lines ) > 1 ) : start_line = 1 ref_line = lines [ start_line ] while ( not ref_line ) : start_line += 1 if ( start_line > len ( lines ) ) : break ref_line = lines [ start_line ] strip_left = ( len ( ref_line ) - len ( ref_line . lstrip ( ) ) ) if strip_left : docs = u'\n' . join ( ( [ lines [ 0 ] ] + [ l [ strip_left : ] for l in lines [ 1 : ] ] ) ) return docs
strip leading tabs from __doc__ text .