def strip_tar_gz(filename):
    """
    Strips ".tar.gz" extensions.

    >>> strip_tar_gz('spam.tar.gz')
    'spam'
    >>> strip_tar_gz('spam.ham')
    'spam.ham'

    """
    if filename.endswith('.tar.gz'):
        return filename[:-7]
    return filename