def ensure_venv():
    """Ensure virtualenv and virtuelenv wrapper is installed"""
    has_venv = bool(subprocess.Popen(
        ['which', 'virtualenv'],
        stdout=subprocess.PIPE).communicate()[0])

    if not has_venv:
        print 'virtualenv is required to run this script. Please install it ' \
              'with\n  easy_install virtualenv\n\nor\n\n  pip virtualenv'
        sys.exit(1)

    has_venv_wrapper = bool(subprocess.Popen(
        ['which', 'virtualenvwrapper.sh'],
        stdout=subprocess.PIPE).communicate()[0])

    if not has_venv_wrapper:
        print 'virtualenvwrapper is required to run this script. Please' \
              'install it with\n  easy_install virtualenvwrapper\n\nor\n\n' \
              'pip virtualenvwrapper'
        sys.exit(1)