def restore_psycopg2():
    """Restores psycopg2"""
    try:
        import psycopg2
    except ImportError:
        pass
    else:
        setattr(psycopg2, 'connect', getattr(psycopg2.connect,
            '__wrapped__', psycopg2.connect))
        setattr(psycopg2.extensions, 'register_type', getattr(psycopg2.
            extensions.register_type, '__wrapped__', psycopg2.extensions.
            register_type))
        setattr(psycopg2._psycopg, 'register_type', getattr(psycopg2.
            _psycopg.register_type, '__wrapped__', psycopg2._psycopg.
            register_type))
        setattr(psycopg2._json, 'register_type', getattr(psycopg2._json.
            register_type, '__wrapped__', psycopg2._json.register_type))
