def __access_member_by_string(x, member):
    """
    Return the result of x.#member or x.#member()
    where member is the name of the function/variable.

    :param x: Element to operate on
    :param member: Function or value member
    :return:
    """
    action = getattr(x, member)
    if callable(action):
        return action()
    else:
        return action
