code: def _expand_list(names):
    
  
    if names is None:
      names = []
    elif isinstance(names, basestring):
      names = [names]
  
    results = []  # The expanded list.
    items = {}  # Cached contents of buckets; used for matching.
    for name in names:
      bucket, key = datalab.storage._bucket.parse_name(name)
      results_len = len(results)  # If we fail to add any we add name and let caller deal with it.
      if bucket:
        if not key:
          # Just a bucket; add it.
          results.append('gs://%s' % bucket)
        elif datalab.storage.Item(bucket, key).exists():
          results.append('gs://%s/%s' % (bucket, key))
        else:
          # Expand possible key values.
          if bucket not in items and key[:1] == '*':
            # We need the full list; cache a copy for efficiency.
            items[bucket] = [item.metadata.name
                             for item in list(datalab.storage.Bucket(bucket).items())]
          # If we have a cached copy use it
          if bucket in items:
            candidates = items[bucket]
          # else we have no cached copy but can use prefix matching which is more efficient than
          # getting the full contents.
          else:
            # Get the non-wildchar prefix.
            match = re.search('\?|\*|\[', key)
            prefix = key
            if match:
              prefix = key[0:match.start()]
  
            candidates = [item.metadata.name
                          for item in datalab.storage.Bucket(bucket).items(prefix=prefix)]
  
          for item in candidates:
            if fnmatch.fnmatch(item, key):
              results.append('gs://%s/%s' % (bucket, item))
  
      # If we added no matches, add the original name and let caller deal with it.
      if len(results) == results_len:
        results.append(name)
  
    return results
docs: Do a wildchar name expansion of object names in a list and return expanded list.
  
      The items are expected to exist as this is used for copy sources or delete targets.
      Currently we support wildchars in the key name only.