def _extract_meta_value(self, node: Any, type_field: str = "t", content_field: str = "c") -> str | list[str] | None:
        """Extract a metadata value from a node.

        Args:
            node: The node to extract metadata from
            type_field: The field name for the node type
            content_field: The field name for the node content

        Returns:
            The extracted metadata value or None if no metadata could be extracted
        """
        if not isinstance(node, dict) or type_field not in node:
            return None

        if (node_type := node.get(type_field)) and (
            node_type == "MetaString" and content_field in node and isinstance(node[content_field], str)
        ):
            return cast("str | list[str] | None", node[content_field])

        if content_field not in node:
            return None

        content = node[content_field]
        node_type = node[type_field]

        if not content:
            return None

        if node_type == "MetaString" and isinstance(content, str):
            return content

        if isinstance(content, list) and (content := [v for v in content if isinstance(v, dict)]):
            if node_type == "MetaInlines":
                return self._extract_inlines(content)

            if node_type == "MetaList":
                results = []
                for value in [value for item in content if (value := self._extract_meta_value(item))]:
                    if isinstance(value, list):
                        results.extend(value)
                    else:
                        results.append(value)
                return results

            if node_type == "MetaBlocks" and (
                blocks := [block for block in content if block.get(type_field) == "Para"]
            ):
                block_texts = []
                for block in blocks:
                    block_content = block.get(content_field, [])
                    if isinstance(block_content, list) and (text := self._extract_inlines(block_content)):
                        block_texts.append(text)

                if block_texts:
                    return " ".join(block_texts)
                return None

        return None
Extract a metadata value from a node.

        Args:
            node: The node to extract metadata from
            type_field: The field name for the node type
            content_field: The field name for the node content

        Returns:
            The extracted metadata value or None if no metadata could be extracted
        
kreuzberg/_extractors/_pandoc.py