'String representation, used by str() and repr().
We produce a short string that conveys all relevant information,
suppressing app and namespace when they are equal to the default.'

def __repr__(self):

    args = []
    for item in self.flat():
        if (not item):
            args.append('None')
        elif isinstance(item, basestring):
            if (not isinstance(item, str)):
                raise TypeError(('Key    item    is    not    an    8-bit    string    %r' % item))
            args.append(repr(item))
        else:
            args.append(str(item))
    if (self.app() != _DefaultAppId()):
        args.append(('app=%r' % self.app()))
    if (self.namespace() != _DefaultNamespace()):
        args.append(('namespace=%r' % self.namespace()))
    return ('Key(%s)' % ',    '.join(args))
