def fast_relpath(path, start):
 if (not path.startswith(start)):
  raise ValueError(u'{} is not a prefix of {}'.format(start, path))
 if (len(path) == len(start)):
  return u''
 elif (len(start) == 0):
  return path
 elif (start[(-1)] == u'/'):
  return path[len(start):]
 elif (path[len(start)] == u'/'):
  return path[(len(start) + 1):]
 else:
  raise ValueError(u'{} is not a directory containing {}'.format(start, path))

def fast_relpath ( path , start ) : if ( not path . startswith ( start ) ) : raise ValueError ( u'{} is not a prefix of {}' . format ( start , path ) ) if ( len ( path ) == len ( start ) ) : return u'' elif ( len ( start ) == 0 ) : return path elif ( start [ ( - 1 ) ] == u'/' ) : return path [ len ( start ) : ] elif ( path [ len ( start ) ] == u'/' ) : return path [ ( len ( start ) + 1 ) : ] else : raise ValueError ( u'{} is not a directory containing {}' . format ( start , path ) )
a prefix-based relpath .