code: def _collect_content_layout(
      layout: List[Dict],
      app: "lightning.app.LightningApp",
      flow: "lightning.app.LightningFlow",
  ) -> Union[List[Dict], Dict]:
      """Process the layout returned by the ``configure_layout()`` method if the returned format represents an
      aggregation of child layouts."""
      for entry in layout:
          if "content" not in entry:
              raise ValueError(
                  f"A dictionary returned by `{flow.__class__.__name__}.configure_layout()` is missing a key 'content'."
                  f" For the value, choose either a reference to a child flow or a URla."
              )
          if isinstance(entry["content"], str):  # assume this is a URL
              url = entry["content"]
              if url.startswith("/"):
                  # The URL isn't fully defined yet. Looks something like ``self.work.url + /something``.
                  entry["target"] = ""
              else:
                  entry["target"] = url
              if url.startswith("http://") and is_running_in_cloud():
                  warnings.warn(
                      f"You configured an http link {url[:32]}... but it won't be accessible in the cloud."
                      f" Consider replacing 'http' with 'https' in the link above."
                  )
  
          elif isinstance(
              entry["content"], lightning.app.LightningFlow
          ):
              entry["content"] = entry["content"].name
  
          elif isinstance(
              entry["content"], lightning.app.LightningWork
          ):
              work = entry["content"]
              work_layout = _collect_work_layout(work)
  
              if work_layout is None:
                  entry["content"] = ""
              elif isinstance(work_layout, str):
                  entry["content"] = work_layout
                  entry["target"] = work_layout
              elif isinstance(
                  work_layout, (Frontend, _MagicMockJsonSerializable)
              ):
                  if len(layout) > 1:
                      lines = _add_comment_to_literal_code(
                          flow.configure_layout,
                          contains="return",
                          comment="  <------- this guy",
                      )
                      m = f"""
                      The return value of configure_layout() in `{flow.__class__.__name__}`  is an
                      unsupported format:
                      \n{lines}
  
                      The tab containing a `{work.__class__.__name__}` must be the only tab in the
                      layout of this flow.
  
                      (see the docs for `LightningWork.configure_layout`).
                      """
                      raise TypeError(m)
  
                  if isinstance(work_layout, Frontend):
                      # If the work returned a frontend, treat it as belonging to the flow.
                      # NOTE: This could evolve in the future to run the Frontend directly in the work machine.
                      frontend = work_layout
                      frontend.flow = flow
                  elif isinstance(
                      work_layout, _MagicMockJsonSerializable
                  ):
                      # The import was mocked, we set a dummy `Frontend` so that `is_headless` knows there is a UI.
                      frontend = "mock"
  
                  app.frontends.setdefault(flow.name, frontend)
                  return flow._layout
  
          elif isinstance(entry["content"], _MagicMockJsonSerializable):
              # The import was mocked, we just record dummy content so that `is_headless` knows there is a UI
              entry["content"] = "mock"
              entry["target"] = "mock"
          else:
              m = f"""
              A dictionary returned by `{flow.__class__.__name__}.configure_layout()` contains an unsupported entry.
  
              {{'content': {repr(entry['content'])}}}
  
              Set the `content` key to a child flow or a URL, for example:
  
              class {flow.__class__.__name__}(LightningFlow):
                  def configure_layout(self):
                      return {{'content': childFlow OR childWork OR 'http://some/url'}}
              """
              raise ValueError(m)
      return layout
  
file_path: pytorch-lightning/src/lightning/app/utilities/layout.py
imports: import inspect
  import warnings
  from typing import Dict, List, Union
  import lightning.app
  from lightning.app.frontend.frontend import Frontend
  from lightning.app.utilities.app_helpers import _MagicMockJsonSerializable, is_overridden
  from lightning.app.utilities.cloud import is_running_in_cloud
label_desc: Use image node_id 3 for calling a global function with example usage: _collect_content_layout(layout, app, flow) and returns: layout, flow