@fiss_cmd<EOL>def space_search(args):
r = fapi.list_workspaces()<EOL>fapi._check_response_code(r, <NUM_LIT:200>)<EOL>workspaces = r.json()<EOL>extra_terms = []<EOL>if args.bucket:<EOL><INDENT>workspaces = [w for w in workspaces<EOL>if re.search(args.bucket, w['<STR_LIT>']['<STR_LIT>'])]<EOL>extra_terms.append('<STR_LIT>')<EOL><DEDENT>pretty_spaces = []<EOL>for space in workspaces:<EOL><INDENT>ns = space['<STR_LIT>']['<STR_LIT>']<EOL>ws = space['<STR_LIT>']['<STR_LIT:name>']<EOL>pspace = ns + '<STR_LIT:/>' + ws<EOL>pspace += '<STR_LIT:\t>' + space['<STR_LIT>']['<STR_LIT>']<EOL>pretty_spaces.append(pspace)<EOL><DEDENT>return sorted(pretty_spaces, key=lambda s: s.lower())<EOL>
Search for workspaces matching certain criteria