code: def get_image_for_repo(self, repo: str, branch: str, git_repo: Repo, repo_path: Path):
          
          requirements_option, requirements_hash = self.get_requirements_information(repo_path)
          dependencies = self.get_dependencies()
  
          logger.info("Getting image based on %s, %s", requirements_option, dependencies)
  
          image_name = self.get_image_name(repo_path, requirements_option, dependencies)
          image_tag = self.get_image_tag(requirements_option, requirements_hash, dependencies)
  
          logger.info("Using image %s:%s", image_name, image_tag)
  
          if self.image_exists(image_name, image_tag):
              image = self.get_image(image_name, image_tag)
  
              # in case the push to registry was set later and the image wasn't pushed when built
              if self.use_registry_name is not None and not self.registry_pull_only:
                  self.push_to_registry(image, image_tag)
  
              return image
  
          if self.use_registry_name is not None:
              # the target image might have been built and pushed in a previous run already, let's try to pull it
              image = self.try_pull_image_from_registry(image_name, image_tag)
  
              if image is not None:  # image wasn't found
                  return image
  
          image = self.build_image(image_name, image_tag, repo_path, requirements_option, dependencies)
  
          if self.use_registry_name is not None and not self.registry_pull_only:
              self.push_to_registry(image, image_tag)
  
          return image
docs: Returns an image for the specific repo (based on settings and requirements).
  
          1. Checks if the image already exists locally
          2. Tries to pull it from registry (if ``use_registry_name`` is set)
          3. Builds the image
          4. Pushes the image to registry so the image is available next time (if ``registry_pull_only`` is not set)
  
          See :meth:`run` for parameters descriptions.
  
          :rtype: docker.models.images.Image