code: def space_search(args):
      
      r = fapi.list_workspaces()
      fapi._check_response_code(r, 200)
  
      # Parse the JSON for workspace + namespace; then filter by
      # search terms: each term is treated as a regular expression
      workspaces = r.json()
      extra_terms = []
      if args.bucket:
          workspaces = [w for w in workspaces
                        if re.search(args.bucket, w['workspace']['bucketName'])]
          extra_terms.append('bucket')
  
      # FIXME: add more filter terms
      pretty_spaces = []
      for space in workspaces:
          ns = space['workspace']['namespace']
          ws = space['workspace']['name']
          pspace = ns + '/' + ws
          # Always show workspace storage id
          pspace += '\t' + space['workspace']['bucketName']
          pretty_spaces.append(pspace)
  
      # Sort for easier viewing, ignore case
      return sorted(pretty_spaces, key=lambda s: s.lower())
docs: Search for workspaces matching certain criteria