import re


def extract_bibtex_items(latex_source):
    """Extract all bibtex items in a LaTeX file which are not commented out."""
    bibtex_item_regex = re.compile(r"""(?<!%)  # Lookbehind to check that the bibtex item is not commented out.
                                (\\bibitem{.*?}.+?)  # Match the entire bibtex item.
                                (?=\\bibitem{|\\end{thebibliography}|$)  # Match only until the next bibtex item, end of bibliography or end of line.
                                """, re.DOTALL | re.VERBOSE)
    return bibtex_item_regex.findall(latex_source)