code: def read_git_branch():
      
      if os.getenv('TRAVIS'):
          return os.getenv('TRAVIS_BRANCH')
      else:
          try:
              repo = git.repo.base.Repo(search_parent_directories=True)
              return repo.active_branch.name
          except Exception:
              return ''
docs: Obtain the current branch name from the Git repository. If on Travis CI,
      use the ``TRAVIS_BRANCH`` environment variable.