code: def get_env(path, ignore_git_branch=False):
      
      if 'DEPLOY_ENVIRONMENT' in os.environ:
          return os.environ['DEPLOY_ENVIRONMENT']
  
      if ignore_git_branch:
          LOGGER.info('Skipping environment lookup from current git branch '
                      '("ignore_git_branch" is set to true in the runway '
                      'config)')
      else:
          # These are not located with the top imports because they throw an
          # error if git isn't installed
          from git import Repo as GitRepo
          from git.exc import InvalidGitRepositoryError
  
          try:
              b_name = GitRepo(
                  path,
                  search_parent_directories=True
              ).active_branch.name
              LOGGER.info('Deriving environment name from git branch %s...',
                          b_name)
              return get_env_from_branch(b_name)
          except InvalidGitRepositoryError:
              pass
      LOGGER.info('Deriving environment name from directory %s...', path)
      return get_env_from_directory(os.path.basename(path))
docs: Determine environment name.