'Utility function for creating a JSON representation of an instance of Credentials.
Args:
strip: array, An array of names of members to not include in the JSON.
Returns:
string, a JSON representation of this instance, suitable to pass to
from_json().'

def _to_json(self, strip):

    t = type(self)
    d = copy.copy(self.__dict__)
    for member in strip:
        if (member in d):
            del d[member]
    if (('token_expiry' in d) and isinstance(d['token_expiry'], datetime.datetime)):
        d['token_expiry'] = d['token_expiry'].strftime(EXPIRY_FORMAT)
    d['_class'] = t.__name__
    d['_module'] = t.__module__
    return simplejson.dumps(d)
