human
Complete this python program:
def load_data(dataset):
assistant
#Here is the Python program you requested.

    """Loads the dataset
    :type dataset: string
    :param dataset: the path to the dataset (here MNIST)
    """
    (data_dir, data_file) = os.path.split(dataset)
    if ((data_dir == '') and (not os.path.isfile(dataset))):
        new_path = os.path.join(os.path.split(__file__)[0], '..', 'data', dataset)
        if (os.path.isfile(new_path) or (data_file == 'mnist.pkl.gz')):
            dataset = new_path
    if ((not os.path.isfile(dataset)) and (data_file == 'mnist.pkl.gz')):
        from six.moves import urllib
        origin = 'http://www.iro.umontreal.ca/~lisa/deep/data/mnist/mnist.pkl.gz'
        print(('Downloading    data    from    %s' % origin))
        urllib.request.urlretrieve(origin, dataset)
    print('...    loading    data')
    with gzip.open(dataset, 'rb') as f:
        try:
            (train_set, valid_set, test_set) = pickle.load(f, encoding='latin1')
        except:
            (train_set, valid_set, test_set) = pickle.load(f)
    def shared_dataset(data_xy, borrow=True):
        '    Function    that    loads    the    dataset    into    shared    variables\n\n                                The    reason    we    store    our    dataset    in    shared    variables    is    to    allow\n                                Theano    to    copy    it    into    the    GPU    memory    (when    code    is    run    on    GPU).\n                                Since    copying    data    into    the    GPU    is    slow,    copying    a    minibatch    everytime\n                                is    needed    (the    default    behaviour    if    the    data    is    not    in    a    shared\n                                variable)    would    lead    to    a    large    decrease    in    performance.\n                                '
        (data_x, data_y) = data_xy
        shared_x = theano.shared(numpy.asarray(data_x, dtype=theano.config.floatX), borrow=borrow)
        shared_y = theano.shared(numpy.asarray(data_y, dtype=theano.config.floatX), borrow=borrow)
        return (shared_x, T.cast(shared_y, 'int32'))
    (test_set_x, test_set_y) = shared_dataset(test_set)
    (valid_set_x,...