Refactor key-to-string code to handle None agents.
Refactor key-to-string code to handle None agents.

johnbachman/indra,johnbachman/belpy,sorgerlab/belpy,johnbachman/belpy,pvtodorov/indra,pvtodorov/indra,sorgerlab/indra,pvtodorov/indra,sorgerlab/belpy,johnbachman/indra,sorgerlab/belpy,johnbachman/belpy,johnbachman/indra,pvtodorov/indra,bgyori/indra,sorgerlab/indra,sorgerlab/indra,bgyori/indra,bgyori/indra