Given a bracket sequence, check whether it is valid and balanced using stack logic.
Implement is_valid_brackets(sequence), where sequence is a string containing only (, ), [, ], {, and }. Return True if every opening bracket is closed by the correct bracket in the correct order, otherwise return False. An empty sequence is valid.
(, ), [, ], {, and }def is_valid_brackets(sequence):