def get_environment():
    """Get the environment in which halo is running

    Returns
    -------
    str
        Environment name
    """
    try:
        from IPython import get_ipython
    except ImportError:
        return 'terminal'
    try:
        shell = get_ipython().__class__.__name__
        if shell == 'ZMQInteractiveShell':
            return 'jupyter'
        elif shell == 'TerminalInteractiveShell':
            return 'ipython'
        else:
            return 'terminal'
    except NameError:
        return 'terminal'
