def relative_uri(base, to):
 if to.startswith(SEP):
  return to
 b2 = base.split(SEP)
 t2 = to.split(SEP)
 for (x, y) in zip(b2[:(-1)], t2[:(-1)]):
  if (x != y):
   break
  b2.pop(0)
  t2.pop(0)
 if (b2 == t2):
  return ''
 if ((len(b2) == 1) and (t2 == [''])):
  return ('.' + SEP)
 return ((('..' + SEP) * (len(b2) - 1)) + SEP.join(t2))

def relative_uri ( base , to ) : if to . startswith ( SEP ) : return to b2 = base . split ( SEP ) t2 = to . split ( SEP ) for ( x , y ) in zip ( b2 [ : ( - 1 ) ] , t2 [ : ( - 1 ) ] ) : if ( x != y ) : break b2 . pop ( 0 ) t2 . pop ( 0 ) if ( b2 == t2 ) : return '' if ( ( len ( b2 ) == 1 ) and ( t2 == [ '' ] ) ) : return ( '.' + SEP ) return ( ( ( '..' + SEP ) * ( len ( b2 ) - 1 ) ) + SEP . join ( t2 ) )
return a relative url from base to to .