<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_dilation_rates(hparams, width):
 """Get a list of valid dilation rates. Args: hparams: HParams. width: spatial dimension. Ensures that the effective filter size is not larger than the spatial dimension. Returns: allowed_dilations: A list of dilation rates. """

  # dil_rate=1 means no dilation.
  allowed_dilations = [[1]*5]
  apply_dilations = hparams.get("latent_apply_dilations", False)
  dilation_rates = hparams.get("latent_dilation_rates", [1, 3])
  if apply_dilations:
    for rate in dilation_rates:
      # k + (k - 1) * rate but k is harcoded to be 3 everywhere.
      filter_size = 3 + 2 * rate
      if filter_size <= width:
        curr_dilation = [1, 1, rate+1, rate+1, 1]
        allowed_dilations.append(curr_dilation)
  return allowed_dilations