import re


def remove_html_tags(text_obj, pandas_apply_mode=True):
    """
    The purpose of this function is to clean up the strings of article
    contents by removing any HTML tags present.
    :param text_obj: This object specifies what will be cleaned. It can
                     either be a single string that represents the
                     content for a single article or the row of a Pandas
                     DataFrame that represent the content of a single
                     article that belongs to a collection of articles.
                     If it is a DataFrame row, then that means that this
                     funciton is being used in the `.apply()` method of
                     a Pandas DataFrame.
    :type text_obj: str or row of a Pandas DataFrame.
    :param pandas_apply_mode: This Boolean controls whether or not this
                              function is being used to clean a single
                              string or an entire column of a DataFrame
                              (which would be the case if this parameter
                              is set to True which is its default
                              value).
    :type pandas_apply_mode: Bool
    :returns: The function itself returns a string the represents the
    cleaned text. Of course, if this function is used with the
                 `.apply()` DataFrame method, then you will get a Pandas
                 Series that contains of all the cleaned content
                 strings.
    :rtype: str
    **Notes**
    1. https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.apply.html
    """
    # Instantiate object that will look for text within html tags.
    cleanr = re.compile("<.*?>|&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});")
    # Determine how we want to go about the cleaning.
    if pandas_apply_mode:
        # If the user is using this function to clean multiple strings
        # that live in a column of a Pandas DataFrame.
        content_str = text_obj.content
        cleantext = re.sub(cleanr, "", content_str)
    else:
        # If the user is simply trying to use this function to clean out
        # a single string.
        # removes anything between <> and any other unneeded html tags
        cleantext = re.sub(cleanr, "", text_obj)
    return cleantext