import re


def tag_contents(obj, tag: str) -> str:
    """ Get everything between an opening tag and its closing tag.

    Args:
        obj (object): beautifulSoup object that begins with an opening tag
                      and ends with the corresponding closing tag.
        tag (string): the HTML tag we want everything inside of.
    Returns:
        tag_contents (string): everything in obj between the opening tag and its closing tag.
    Raises:
        none.
    """
    contents = obj.prettify()  # The newlines below depend on using prettify.
    contents = re.sub("<{}.*?>\n".format(tag), "", contents)
    contents = re.sub("\n</{}>".format(tag), "", contents)
    return contents