def groups_balanced(arg):
    """
    Match [, {, and ( for balance

    >>> groups_balanced("(a) and (b)")
    True
    >>> groups_balanced("((a) and (b))")
    True
    >>> groups_balanced("((a) and (b)")
    False
    >>> groups_balanced(" [a] and [b]   ")
    True
    >>> groups_balanced("((a) and [(b)])")
    True
    >>> groups_balanced("((a) and [(b))]")
    False

    """
    arg = arg.strip()
    open_list = ["(", "[", "{"]
    close_list = [")", "]", "}"]    
    stack = []
    for i in arg:
        if i in open_list:
            stack.append(i)
        elif i in close_list:
            pos = close_list.index(i)
            if ((len(stack) > 0) and
                (open_list[pos] == stack[len(stack)-1])):
                stack.pop()
            else:
                return False

    if len(stack) == 0:
        return True
    else:
        return False