code: def get_version(self, cached=True):
          
          if hasattr(self.__class__, '_version') and cached:
              version = self.__class__._version
          else:
              repo = self.get_repo()
              if repo is not None:
                  head = repo.head
                  version = head.commit.hexsha
                  if repo.is_dirty():
                      version += "*"
              else:
                  version = None
          self.__class__._version = version
          return version
docs: Get a git version (i.e. a git commit hash) for this instance.