import zipfile


def unzip_file(fname):
    """
    Unzip a zipped file into memory.

    @param fname (str) The name of the file to unzip.

    @return (ZipFile object) A zipfile.ZipFile object with the unzipped file
    contents.
    """

    # Is this a ZIP file?
    if (not zipfile.is_zipfile(fname)):
        return None
        
    # This is a ZIP file. Unzip it.
    unzipped_data = zipfile.ZipFile(fname, 'r')

    # Return the unzipped data.
    return unzipped_data