import re


def get_mol2_records(lines):
    """Search for the MOLECULE, ATOM and BOND records of a mol2 file.
    Returns 3 lists of lines where the record starts"""
    mol_lines        = []
    first_atom_lines = []
    first_bond_lines = []

    for i, line in enumerate(lines):
        search_molecule = re.search(r'@<TRIPOS>MOLECULE', line)
        search_atom     = re.search(r'@<TRIPOS>ATOM', line)
        search_bond     = re.search(r'@<TRIPOS>BOND', line)

        if search_molecule:
            # line with the number of atoms and bonds
            mol_lines.append(i)
        elif search_atom:
            # first line with atom coordinates
            first_atom_lines.append(i)
        elif search_bond:
            # first line with bond information
            first_bond_lines.append(i)

    return mol_lines, first_atom_lines, first_bond_lines