Write a comprehensive, ready-to-paste docstring/comment block for the provided function or class.
1) Analyze the code to identify its purpose, parameters (names, types, defaults), return values, side effects, exceptions, and whether it is async or a generator.
2) Produce a single docstring/comment in Docstring Style for Language.
3) Include sections as applicable: summary (one sentence, imperative), brief description, Parameters/Args, Returns or Yields, Raises, Attributes (for classes), and Notes only when needed for clarity.
4) Infer types from annotations and usage; if unknown, use a style-appropriate placeholder (e.g., Any or omit type per the style).
5) Preserve names and behavior; do not alter or add code; no TODOs.
6) Output only the docstring/comment block with correct delimiters for Language; no backticks or extra text.
• Follow the exact formatting and section names of Docstring Style.
• Document each parameter with name, type, purpose, and default if present.
• If nothing is returned, document that per the style (e.g., Returns: None).
• For generators, use Yields instead of Returns; for async functions, document returns as usual.
• For classes, summarize the class, document constructor args under Args/Parameters, and list key attributes if present.
• Avoid speculation beyond the code; be precise and concise.
<example>
Docstring Style: Google
Language: Python
Input code:
def add(a: int, b: int = 0) -> int:
return a + b
Expected output:
"""Add two integers.
Args:
a (int): First addend.
b (int, optional): Second addend. Defaults to 0.
Returns:
int: Sum of a and b.
"""
</example>
Code:
<code-snippet>
Code Snippet
</code-snippet>