<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getAPIKey(self, keyID=None):
 """ Retrieve the NS1 API Key for the given keyID :param str keyID: optional keyID to retrieve, or current if not passed :return: API Key for the given keyID """

        kcfg = self.getKeyConfig(keyID)
        if 'key' not in kcfg:
            raise ConfigException('invalid config: missing api key')
        return kcfg['key']