import logging


def get_title_index(header):
    """
    Utility function to get the index of the column that contains the titles of the movies
    the actor has starred in.
    :param header: The Beautiful Soup object containing the header row of the table (html).
    :return: The index of the column with heading 'Title', if found, else -1
    """
    logging.info("get_title_index called.")
    try:
        for i, col_heading in enumerate(header.find_all('th')):
            if col_heading.get_text() == 'Title':
                return i, len(header.find_all('th'))
    except(Exception):
        logging.warning("Couldn't find column for Title. Returning -1")
        return -1

    return -1