def document(value: Any, doc_string: str = ''):
    """Stores documentation details about the given value.

    This method is used to associate a docstring with global constants. It is
    also used to indicate that a private method should be included in the public
    documentation (e.g. when documenting protocols or arithmetic operations).

    The given documentation information is filed under `id(value)` in
    `cirq._doc.RECORDED_CONST_DOCS`.

    Args:
        value: The value to associate with documentation information.
        doc_string: The doc string to associate with the value. Defaults to the
            value's __doc__ attribute.

    Returns:
        The given value.
    """
    RECORDED_CONST_DOCS[id(value)] = doc_string

    ## this is how the devsite API generator picks up
    ## docstrings for type aliases
    try:
        value.__doc__ = doc_string
    except AttributeError:
        # we have a couple (~ 7) global constants of type list, tuple, dict,
        # that fail here as their __doc__ attribute is read-only.
        # For the time being these are not going to be part of the generated
        # API docs. See https://github.com/quantumlib/Cirq/issues/3276 for
        # more info.

        # to list them, uncomment these lines and run `import cirq`:
        # print(f"WARNING: {e}")
        # print(traceback.format_stack(limit=2)[0])
        pass
    return value
Stores documentation details about the given value.

    This method is used to associate a docstring with global constants. It is
    also used to indicate that a private method should be included in the public
    documentation (e.g. when documenting protocols or arithmetic operations).

    The given documentation information is filed under `id(value)` in
    `cirq._doc.RECORDED_CONST_DOCS`.

    Args:
        value: The value to associate with documentation information.
        doc_string: The doc string to associate with the value. Defaults to the
            value's __doc__ attribute.

    Returns:
        The given value.
    
cirq-core/cirq/_doc.py