def _getattribute(self, attr, component, clsname=None):
    """Get attribute value from a class components.

    Parameters
    ----------
    attr : str
        Attribute name.
    component : str
        Component name.
    clsname : str
        Optional class name.
        If `None` then instance components are searched.
    """
    components = self._getcomponents(clsname)
    try:
        component = components[component]
    except KeyError:
        raise AttributeError(f"'{clsname}' does not have component '{component}'")
    return getattr(component, attr)