def is_each_row_balanced(self, exclude_special_rows_of_syntax=None):
    '\n        Checks whether each row in buffer is balanced (i.e., does not have unmatched parantheses, brackets, etc). Can\n        exclude special row types (e.g., comment) from evaluation.\n\n        Args:\n            exclude_special_rows_of_syntax(str): specifies what type of rows to exclude from evaluation\n                (e.g., comment rows). Uses predefined syntax settings per specified syntax (e.g., \'bibtex\').\n\n        Keyword Args:\n            - bibtex (exclude_special_rows_of_syntax): sets evaluation exclusion criteria for bibtex syntax\n\n        Returns:\n            boolean\n\n        Examples:\n            >>> # an unbalanced row is present\n            >>> my_buffer = ListBuffer()\n            >>> my_buffer.append_row([\'a\', \'b\', \'c\']).append_row([\'d\', \'e\', \'f\']).dataset\n            [[\'a\', \'b\', \'c\'], [\'d\', \'e\', \'f\']]\n            >>> my_buffer.append_row([\'g\', \'h\' , \'>\'])                    .is_each_row_balanced()\n            False\n\n            >>> # single row from a bib file\n            >>> my_buffer = ListBuffer()\n            >>> my_buffer.append_row(\'            year      = "2017",\')                .is_each_row_balanced()\n            True\n\n            >>> # bibtex entry start (no exception vs. exception)\n            >>> my_buffer.append_row(\'@article{96d9add3e2f44e8abbf030170689bc30,\')                .is_each_row_balanced()\n            False\n            >>> my_buffer.is_each_row_balanced(exclude_special_rows_of_syntax=\'bibtex\')\n            True\n\n            >>> # bibtex comment (no exception vs. exception)\n            >>> my_buffer = ListBuffer()\n            >>> my_buffer.append_row(\'% This is a comment with an unbalanced characters }]>\')                .is_each_row_balanced()\n            False\n            >>> my_buffer.is_each_row_balanced(exclude_special_rows_of_syntax=\'bibtex\')\n            True\n\n            >>> # a full bibtex entry with an unbalanced curly bracket at title field\n            >>> my_buffer = ListBuffer()\n            >>> my_buffer.dataset = [\'@book{a82caf00e1a143759c7f5543b6c84ea5,\', \'title     = "{Knowledge Representation for Health Care (AIME 2015 International Joint Workshop, KR4HC/ProHealth 2015)",\', \'author    = "D Riano and R. Lenz and S Miksch and M Peleg and M. Reichert and {ten Teije}, A.C.M.",\', \'year      = "2015",\', \'doi       = "10.1007/978-3-319-26585-8",\', \'isbn      = "9783319265841",\', \'series    = "LNAI",\', \'publisher = "Springer",\', \'number    = "9485",\', \'}\', \'\']\n            >>> my_buffer.is_each_row_balanced(exclude_special_rows_of_syntax=\'bibtex\')  # error\n            False\n            >>> # the same entry with unbalanced curly bracket removed\n            >>> my_buffer.dataset = [\'@book{a82caf00e1a143759c7f5543b6c84ea5,\', \'title     = "Knowledge Representation for Health Care (AIME 2015 International Joint Workshop, KR4HC/ProHealth 2015)",\', \'author    = "D Riano and R. Lenz and S Miksch and M Peleg and M. Reichert and {ten Teije}, A.C.M.",\', \'year      = "2015",\', \'doi       = "10.1007/978-3-319-26585-8",\', \'isbn      = "9783319265841",\', \'series    = "LNAI",\', \'publisher = "Springer",\', \'number    = "9485",\', \'}\', \'\']\n            >>> my_buffer.is_each_row_balanced(exclude_special_rows_of_syntax=\'bibtex\')\n            True\n\n        '
    from preprocessor.string_tools import String
    buffer = self.dataset
    is_balanced_log = []
    for each_row in buffer:
        each_row = String(str(each_row))
        if (not each_row.is_balanced()):
            if (exclude_special_rows_of_syntax == 'bibtex'):
                if (each_row.is_line_type('bibtex', 'start of entry') or each_row.is_line_type('bibtex', 'end of entry') or each_row.is_line_type('bibtex', 'comment')):
                    is_balanced_log.append(True)
                else:
                    is_balanced_log.append(False)
            else:
                is_balanced_log.append(False)
        else:
            is_balanced_log.append(True)
    if (False in is_balanced_log):
        return False
    else:
        return True
Checks whether each row in buffer is balanced (i.e., does not have unmatched parantheses, brackets, etc). Can
exclude special row types (e.g., comment) from evaluation.

Args:
    exclude_special_rows_of_syntax(str): specifies what type of rows to exclude from evaluation
        (e.g., comment rows). Uses predefined syntax settings per specified syntax (e.g., 'bibtex').

Keyword Args:
    - bibtex (exclude_special_rows_of_syntax): sets evaluation exclusion criteria for bibtex syntax

Returns:
    boolean

Examples:
    >>> # an unbalanced row is present
    >>> my_buffer = ListBuffer()
    >>> my_buffer.append_row(['a', 'b', 'c']).append_row(['d', 'e', 'f']).dataset
    [['a', 'b', 'c'], ['d', 'e', 'f']]
    >>> my_buffer.append_row(['g', 'h' , '>'])                    .is_each_row_balanced()
    False

    >>> # single row from a bib file
    >>> my_buffer = ListBuffer()
    >>> my_buffer.append_row('            year      = "2017",')                .is_each_row_balanced()
    True

    >>> # bibtex entry start (no exception vs. exception)
    >>> my_buffer.append_row('@article{96d9add3e2f44e8abbf030170689bc30,')                .is_each_row_balanced()
    False
    >>> my_buffer.is_each_row_balanced(exclude_special_rows_of_syntax='bibtex')
    True

    >>> # bibtex comment (no exception vs. exception)
    >>> my_buffer = ListBuffer()
    >>> my_buffer.append_row('% This is a comment with an unbalanced characters }]>')                .is_each_row_balanced()
    False
    >>> my_buffer.is_each_row_balanced(exclude_special_rows_of_syntax='bibtex')
    True

    >>> # a full bibtex entry with an unbalanced curly bracket at title field
    >>> my_buffer = ListBuffer()
    >>> my_buffer.dataset = ['@book{a82caf00e1a143759c7f5543b6c84ea5,', 'title     = "{Knowledge Representation for Health Care (AIME 2015 International Joint Workshop, KR4HC/ProHealth 2015)",', 'author    = "D Riano and R. Lenz and S Miksch and M Peleg and M. Reichert and {ten Teije}, A.C.M.",', 'year      = "2015",', 'doi       = "10.1007/978-3-319-26585-8",', 'isbn      = "9783319265841",', 'series    = "LNAI",', 'publisher = "Springer",', 'number    = "9485",', '}', '']
    >>> my_buffer.is_each_row_balanced(exclude_special_rows_of_syntax='bibtex')  # error
    False
    >>> # the same entry with unbalanced curly bracket removed
    >>> my_buffer.dataset = ['@book{a82caf00e1a143759c7f5543b6c84ea5,', 'title     = "Knowledge Representation for Health Care (AIME 2015 International Joint Workshop, KR4HC/ProHealth 2015)",', 'author    = "D Riano and R. Lenz and S Miksch and M Peleg and M. Reichert and {ten Teije}, A.C.M.",', 'year      = "2015",', 'doi       = "10.1007/978-3-319-26585-8",', 'isbn      = "9783319265841",', 'series    = "LNAI",', 'publisher = "Springer",', 'number    = "9485",', '}', '']
    >>> my_buffer.is_each_row_balanced(exclude_special_rows_of_syntax='bibtex')
    True
def is_each_row_balanced(self, exclude_special_rows_of_syntax=None):
    '\n        Checks whether each row in buffer is balanced (i.e., does not have unmatched parantheses, brackets, etc). Can\n        exclude special row types (e.g., comment) from evaluation.\n\n        Args:\n            exclude_special_rows_of_syntax(str): specifies what type of rows to exclude from evaluation\n                (e.g., comment rows). Uses predefined syntax settings per specified syntax (e.g., \'bibtex\').\n\n        Keyword Args:\n            - bibtex (exclude_special_rows_of_syntax): sets evaluation exclusion criteria for bibtex syntax\n\n        Returns:\n            boolean\n\n        Examples:\n            >>> # an unbalanced row is present\n            >>> my_buffer = ListBuffer()\n            >>> my_buffer.append_row([\'a\', \'b\', \'c\']).append_row([\'d\', \'e\', \'f\']).dataset\n            [[\'a\', \'b\', \'c\'], [\'d\', \'e\', \'f\']]\n            >>> my_buffer.append_row([\'g\', \'h\' , \'>\'])                    .is_each_row_balanced()\n            False\n\n            >>> # single row from a bib file\n            >>> my_buffer = ListBuffer()\n            >>> my_buffer.append_row(\'            year      = "2017",\')                .is_each_row_balanced()\n            True\n\n            >>> # bibtex entry start (no exception vs. exception)\n            >>> my_buffer.append_row(\'@article{96d9add3e2f44e8abbf030170689bc30,\')                .is_each_row_balanced()\n            False\n            >>> my_buffer.is_each_row_balanced(exclude_special_rows_of_syntax=\'bibtex\')\n            True\n\n            >>> # bibtex comment (no exception vs. exception)\n            >>> my_buffer = ListBuffer()\n            >>> my_buffer.append_row(\'% This is a comment with an unbalanced characters }]>\')                .is_each_row_balanced()\n            False\n            >>> my_buffer.is_each_row_balanced(exclude_special_rows_of_syntax=\'bibtex\')\n            True\n\n            >>> # a full bibtex entry with an unbalanced curly bracket at title field\n            >>> my_buffer = ListBuffer()\n            >>> my_buffer.dataset = [\'@book{a82caf00e1a143759c7f5543b6c84ea5,\', \'title     = "{Knowledge Representation for Health Care (AIME 2015 International Joint Workshop, KR4HC/ProHealth 2015)",\', \'author    = "D Riano and R. Lenz and S Miksch and M Peleg and M. Reichert and {ten Teije}, A.C.M.",\', \'year      = "2015",\', \'doi       = "10.1007/978-3-319-26585-8",\', \'isbn      = "9783319265841",\', \'series    = "LNAI",\', \'publisher = "Springer",\', \'number    = "9485",\', \'}\', \'\']\n            >>> my_buffer.is_each_row_balanced(exclude_special_rows_of_syntax=\'bibtex\')  # error\n            False\n            >>> # the same entry with unbalanced curly bracket removed\n            >>> my_buffer.dataset = [\'@book{a82caf00e1a143759c7f5543b6c84ea5,\', \'title     = "Knowledge Representation for Health Care (AIME 2015 International Joint Workshop, KR4HC/ProHealth 2015)",\', \'author    = "D Riano and R. Lenz and S Miksch and M Peleg and M. Reichert and {ten Teije}, A.C.M.",\', \'year      = "2015",\', \'doi       = "10.1007/978-3-319-26585-8",\', \'isbn      = "9783319265841",\', \'series    = "LNAI",\', \'publisher = "Springer",\', \'number    = "9485",\', \'}\', \'\']\n            >>> my_buffer.is_each_row_balanced(exclude_special_rows_of_syntax=\'bibtex\')\n            True\n\n        '
    from preprocessor.string_tools import String
    buffer = self.dataset
    is_balanced_log = []
    for each_row in buffer:
        each_row = String(str(each_row))
        if (not each_row.is_balanced()):
            if (exclude_special_rows_of_syntax == 'bibtex'):
                if (each_row.is_line_type('bibtex', 'start of entry') or each_row.is_line_type('bibtex', 'end of entry') or each_row.is_line_type('bibtex', 'comment')):
                    is_balanced_log.append(True)
                else:
                    is_balanced_log.append(False)
            else:
                is_balanced_log.append(False)
        else:
            is_balanced_log.append(True)
    if (False in is_balanced_log):
        return False
    else:
        return True