import gzip
import pickle


def load( file ):
    """Give a file or filename, load as a gzpickle file"""
    if isinstance( file, str ):
        file = gzip.GzipFile( filename=file, mode = 'rb', )
    else:
        file = gzip.GzipFile( mode = 'rb', fileobj = file )
    try:
        value = pickle.load(file)
    finally:
        file.close()
    return value