code: def get_scope(self, which, labels):
          
  
          try:
              scope_choice = labels[self.SCOPE_LABEL]
          except (KeyError, TypeError):
              self.log.debug("no distribution scope set for %s image", which)
              raise NothingToCheck
  
          try:
              scope = self.SCOPE_NAME.index(scope_choice)
          except ValueError:
              self.log.warning("invalid label %s=%s for %s image",
                               self.SCOPE_LABEL, scope_choice, which)
              raise NothingToCheck
  
          return scope
docs: :param which: str, description of the image this belongs to
          :param labels: dict, labels on the image