def _storage_delete(args, _):
  """ Delete one or more buckets or objects. """
  items = _expand_list(args['bucket'])
  items.extend(_expand_list(args['object']))
  errs = []
  for item in items:
    try:
      bucket, key = datalab.storage._bucket.parse_name(item)
      if bucket and key:
        gcs_item = datalab.storage.Item(bucket, key)
        if gcs_item.exists():
          datalab.storage.Item(bucket, key).delete()
        else:
          errs.append("%s does not exist" % item)
      elif bucket:
        gcs_bucket = datalab.storage.Bucket(bucket)
        if gcs_bucket.exists():
          gcs_bucket.delete()
        else:
          errs.append("%s does not exist" % item)
      else:
        raise Exception("Can't delete item with invalid name %s" % item)
    except Exception as e:
      errs.append("Couldn't delete %s: %s" %
                  (item, _extract_storage_api_response_error(str(e))))
  if errs:
    raise Exception('\n'.join(errs))
Delete one or more buckets or objects.