def _get_design_matrix(model):
  """Returns the design matrix for an STS model with a regression component.

  If there is not a design matrix, None is returned.

  Args:
    model: A `tfp.sts.StructuralTimeSeries` model instance return by
      `build_model_for_gibbs_fitting`.
  """
  design_matrices = [
      component.design_matrix
      for component in model.components
      if hasattr(component, 'design_matrix')
  ]
  if not design_matrices:
    return None
  if len(design_matrices) > 1:
    raise ValueError('Model contains multiple regression components.')
  return design_matrices[0]