def line_number(reactype, lxfile):
    """Return the line number from which to read the data for a given reaction type."""
    with open(lxfile, 'r') as f:
        reaction_number = eval(reactype[-1]) if reactype[-1].isdigit() else 1
        lines = f.readlines()
        good_line_numbers = []
        for a, b in enumerate(lines):
            if b.startswith(reactype):
                good_line_numbers.append(a)
        try:
            return good_line_numbers[reaction_number - 1]
        except IndexError:
            print('reaction {} not found'.format(reactype))
