def mxnet_prefer_gpu():
    """If gpu available return gpu, else cpu

    Returns
    -------
    context : Context
        The preferable GPU context.
    """
    gpu = int(os.environ.get('MXNET_GPU', default=0))
    if gpu in mx.test_utils.list_gpus():
        return mx.gpu(gpu)
    return mx.cpu()