<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sample_uniform(domain, rng):
 """Sample a value uniformly from a domain. Args: domain: An `IntInterval`, `RealInterval`, or `Discrete` domain. rng: A `random.Random` object; defaults to the `random` module. Raises: TypeError: If `domain` is not a known kind of domain. IndexError: If the domain is empty. """

  if isinstance(domain, hp.IntInterval):
    return rng.randint(domain.min_value, domain.max_value)
  elif isinstance(domain, hp.RealInterval):
    return rng.uniform(domain.min_value, domain.max_value)
  elif isinstance(domain, hp.Discrete):
    return rng.choice(domain.values)
  else:
    raise TypeError("unknown domain type: %r" % (domain,))