def setAPIKey(registry, api_key):
if (registry is None) or (registry == Registry_Base_URL):<EOL><INDENT>return<EOL><DEDENT>sources = _getSources()<EOL>source = None<EOL>for s in sources:<EOL><INDENT>if _sourceMatches(s, registry):<EOL><INDENT>source = s<EOL><DEDENT><DEDENT>if source is None:<EOL><INDENT>source = {<EOL>'<STR_LIT:type>':'<STR_LIT>',<EOL>'<STR_LIT:url>':registry,<EOL>}<EOL>sources.append(source)<EOL><DEDENT>source['<STR_LIT>'] = api_key<EOL>settings.set('<STR_LIT>', sources)<EOL>
Set the api key for accessing a registry. This is only necessary for
        development/test registries.