def METHOD_NAME(structure):
  """Recursively replaces CompositeTensors with their components.
  Args:
    structure: A `nest`-compatible structure, possibly containing composite
      tensors.
  Returns:
    A copy of `structure`, where each composite tensor has been replaced by
    its components.  The result will contain no composite tensors.
    Note that `nest.flatten(replace_composites_with_components(structure))`
    returns the same value as `nest.flatten(structure)`.
  """
  if isinstance(structure, CompositeTensor):
    return METHOD_NAME(structure._to_components())  # pylint: disable=protected-access
  elif not nest.is_sequence(structure):
    return structure
  else:
    return nest.map_structure(METHOD_NAME, structure,
                              expand_composites=False)