code: def get_env_value(name: str, required: bool=False, default: Any=empty) -> str:
      
      if required and default is not empty:
          raise ValueError("Using `default` with `required=True` is invalid")
      elif required:
          try:
              value = os.environ[name]
          except KeyError:
              raise KeyError(
                  "Must set environment variable {0}".format(name)
              )
      else:
          value = os.environ.get(name, default)
      return value
docs: Core function for extracting the environment variable.
  
      Enforces mutual exclusivity between `required` and `default` keywords.
  
      The `empty` sentinal value is used as the default `default` value to allow
      other function to handle default/empty logic in the appropriate way.