Build a Token class, based upon the function arguments in the closure,
  and return an instantiation of it. This allows us return an object
  with truly read-only properties :) These 'hoops' suggest that this is
  probably 'unpythonic', but what can you do?!

  n.b., This shouldn't be invoked directly.

def _tokenFactory(authenticated):
  '''
  Build a Token class, based upon the function arguments in the closure,
  and return an instantiation of it. This allows us return an object
  with truly read-only properties :) These 'hoops' suggest that this is
  probably 'unpythonic', but what can you do?!

  n.b., This shouldn't be invoked directly.
  '''

  if not authenticated:
    weAreGood = False
    authenticated = { 'data': None, 'expiration': None }

  else:
    weAreGood = True

  class Token(object):
    def __dir__(self):
      ''' Class members '''
      return ['valid'] + authenticated.keys()

    def __getattribute__(self, name):
      ''' Fake attributes '''
      if name == 'valid':
        if weAreGood:
          return datetime.now() <= authenticated['expiration']

        else:
          return False

      if name in authenticated:
        return authenticated[name]

      else:
        # No such attribute
        raise AttributeError('Object has no attribute \'%s\'' % name)

    def __setattr__(self, value, name):
      ''' We can't set any attribute values '''
      raise AttributeError('Cannot set read-only attribute')

  return Token()