def _common_path(p1, p2):
 while (p1 and p2):
  if (p1 == p2):
   return p1
  if (len(p1) > len(p2)):
   p1 = os.path.dirname(p1)
  else:
   p2 = os.path.dirname(p2)
 return ''

def _common_path ( p1 , p2 ) : while ( p1 and p2 ) : if ( p1 == p2 ) : return p1 if ( len ( p1 ) > len ( p2 ) ) : p1 = os . path . dirname ( p1 ) else : p2 = os . path . dirname ( p2 ) return ''
returns the longest path common to p1 and p2 .