def all_members(cls):
    """All members of a class.

    Credit: Jürgen Hermann, Alex Martelli. From
    https://www.oreilly.com/library/view/python-cookbook/0596001673/ch05s03.html.


    Parameters
    ----------
    cls : class

    Returns
    -------
    dict
        Similar to ``cls.__dict__``, but include also the inherited members.

    Examples
    --------
    >>> class Parent(object):
    ...     attribute_parent = 42
    >>> class Child(Parent):
    ...     attribute_child = 51
    >>> 'attribute_child' in all_members(Child).keys()
    True
    >>> 'attribute_parent' in all_members(Child).keys()
    True
    """
    try:
        # Try getting all relevant classes in method-resolution order
        mro = list(cls.__mro__)
    except AttributeError:
        # If a class has no _ _mro_ _, then it's a classic class
        def getmro(a_class, recurse):
            an_mro = [a_class]
            for base in a_class.__bases__:
                an_mro.extend(recurse(base, recurse))
            return an_mro

        mro = getmro(cls, getmro)
    mro.reverse()
    members = {}
    for someClass in mro:
        members.update(vars(someClass))
    return members