code: def _ScopesFromMetadataServer(self, scopes):
          
          if not util.DetectGce():
              raise exceptions.ResourceUnavailableError(
                  'GCE credentials requested outside a GCE instance')
          if not self.GetServiceAccount(self.__service_account_name):
              raise exceptions.ResourceUnavailableError(
                  'GCE credentials requested but service account '
                  '%s does not exist.' % self.__service_account_name)
          if scopes:
              scope_ls = util.NormalizeScopes(scopes)
              instance_scopes = self.GetInstanceScopes()
              if scope_ls > instance_scopes:
                  raise exceptions.CredentialsError(
                      'Instance did not have access to scopes %s' % (
                          sorted(list(scope_ls - instance_scopes)),))
          else:
              scopes = self.GetInstanceScopes()
          return scopes
docs: Returns instance scopes based on GCE metadata server.