def getattr_nested(obj, attrs):
    """Support getting nested attributes
    Args:
        obj   -- object to get attributes from
        attrs -- attribute accessor string
                 This should be a dot separated list of attributes to access,
                 just like when typeing the code out

    Examples
    >>> A = namedtuple('A', 'x,y')
    >>> a = A(A(1, 2), A(3, 4))
    >>> getattr_nested(a, 'x.x')
    1
    >>> getattr_nested(a, 'y.x')
    3
    """
    for attr in attrs.split('.'):
        obj = getattr(obj, attr)
    return obj