def filter_blobnames_for_prefix(candidates, prefix, sep):
 matches = set()
 if (not prefix):
  for name in candidates:
   if (name == '*'):
    continue
   if (sep in name):
    matches.add((name[:name.index(sep)], True))
   else:
    matches.add((name, False))
 else:
  sep_len = len(sep)
  sepped_prefix = sep.join(prefix)
  for name in candidates:
   if (name == '*'):
    continue
   if name.startswith((sepped_prefix + sep)):
    subname = name[(len(sepped_prefix) + sep_len):]
    if (sep in subname):
     subname = subname[:subname.index(sep)]
     is_partial_match = True
    else:
     is_partial_match = False
    matches.add((subname, is_partial_match))
 return matches

def filter_blobnames_for_prefix ( candidates , prefix , sep ) : matches = set ( ) if ( not prefix ) : for name in candidates : if ( name == '*' ) : continue if ( sep in name ) : matches . add ( ( name [ : name . index ( sep ) ] , True ) ) else : matches . add ( ( name , False ) ) else : sep_len = len ( sep ) sepped_prefix = sep . join ( prefix ) for name in candidates : if ( name == '*' ) : continue if name . startswith ( ( sepped_prefix + sep ) ) : subname = name [ ( len ( sepped_prefix ) + sep_len ) : ] if ( sep in subname ) : subname = subname [ : subname . index ( sep ) ] is_partial_match = True else : is_partial_match = False matches . add ( ( subname , is_partial_match ) ) return matches
given a iterator of candidate blob names .