'Test wheter the package is installed.
Returns two values: a status indicator which is one of
"yes", "no", "old" (an older version is installed) or "bad"
(something went wrong during the install test) and a human
readable string which may contain more details.'

def installed(self):

    namespace = {'NotInstalled': _scriptExc_NotInstalled, 'OldInstalled': _scriptExc_OldInstalled, 'BadInstalled': _scriptExc_BadInstalled, 'os': os, 'sys': sys}
    installTest = (self._dict['Install-test'].strip() + '\n')
    try:
        exec installTest in namespace
    except ImportError as arg:
        return ('no', str(arg))
    except _scriptExc_NotInstalled as arg:
        return ('no', str(arg))
    except _scriptExc_OldInstalled as arg:
        return ('old', str(arg))
    except _scriptExc_BadInstalled as arg:
        return ('bad', str(arg))
    except:
        sys.stderr.write('-------------------------------------\n')
        sys.stderr.write(('----    %s:    install    test    got    exception\n' % self.fullname()))
        sys.stderr.write('----    source:\n')
        sys.stderr.write(installTest)
        sys.stderr.write('----    exception:\n')
        import traceback
        traceback.print_exc(file=sys.stderr)
        if self._db._maintainer:
            sys.stderr.write(('----    Please    copy    this    and    mail    to    %s\n' % self._db._maintainer))
        sys.stderr.write('-------------------------------------\n')
        return ('bad', 'Package    install    test    got    exception')
    return ('yes', '')
