def METHOD_NAME(out, obj, prefix=None):
    if prefix is not None:
        out.first_prefix.append(prefix)
        out.later_prefix.append(prefix)
    try:
        if obj.__doc__ is None:
            raise ValueError(f"no docs for {obj!r}")
        # Docstrings start with an unindented line, everything else is
        # consistently indented.
        lines = obj.__doc__.split("\n")
        # some docstrings start on the second line
        if firstline := lines[0].strip():
            out.write(firstline)
        if len(lines) > 1:
            for line in textwrap.dedent("\n".join(lines[1:])).split("\n"):
                out.write(line)
        else:
            out.write()
    finally:
        if prefix is not None:
            out.first_prefix.pop()
            out.later_prefix.pop()