message: Adding explicit boolean conversion to `expand_composites` arg.
  Fixes
  Currently on violation it results in crashing, this explicit conversion helps to raise ValueError from python.
diff: @@ -337,6 +337,7 @@ def flatten(structure, expand_composites=False):
  """
  if structure is None:
  return [None]
  + expand_composites = bool(expand_composites)
  return _pywrap_utils.Flatten(structure, expand_composites)
  