Extract the text from the various sections of a numpy-formatted docstring.

        Parameters
        ----------
        doc: Union[str, None]

        Returns
        -------
        OrderedDict[str, Union[None,str]]
            The extracted numpy-styled docstring sections.

def parse_numpy_doc(doc):
    """ Extract the text from the various sections of a numpy-formatted docstring.

        Parameters
        ----------
        doc: Union[str, None]

        Returns
        -------
        OrderedDict[str, Union[None,str]]
            The extracted numpy-styled docstring sections."""

    doc_sections = OrderedDict([("Short Summary", None),
                                ("Deprecation Warning", None),
                                ("Attributes", None),
                                ("Extended Summary", None),
                                ("Parameters", None),
                                ("Returns", None),
                                ("Yields", None),
                                ("Other Parameters", None),
                                ("Raises", None),
                                ("See Also", None),
                                ("Notes", None),
                                ("References", None),
                                ("Examples", None)])

    if not doc:
        return doc_sections

    doc = cleandoc(doc)
    lines = iter(doc.splitlines())

    key = "Short Summary"
    body = []
    while True:
        try:
            line = next(lines).rstrip()
            if line in doc_sections:
                doc_sections[key] = "\n".join(body).rstrip() if body else None
                body = []
                key = line
                next(lines)  # skip section delimiter
            else:
                body.append(line)
        except StopIteration:
            doc_sections[key] = "\n".join(body)
            break

    return doc_sections