<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def removeContainer(tag):
    '''Check if a container with a given tag exists. Kill it if it exists.
    No extra side effects. Handles and reraises TypeError, and
    APIError exceptions.
    '''
    container = getContainerByTag(tag)

    if container:
        # Build an Image using the dockerfile in the path
        try:
            container.remove(force=True)
            #print("Removed container", tag, "...")
        except APIError as exc:
            eprint("Unhandled error while removing container", tag)
            raise exc