code: def serialize(self):
          
          data = {
              'local_id': self.local_id(),
              'institution': self.institution.serialize(),
              'number': self.number,
              'description': self.description
          }
          if hasattr(self, 'broker_id'):
              data['broker_id'] = self.broker_id
          elif hasattr(self, 'routing_number'):
              data['routing_number'] = self.routing_number
              data['account_type'] = self.account_type
  
          return data
docs: Serialize predictably for use in configuration storage.
  
          Output look like this::
  
            {
              'local_id':       'string',
              'number':         'account num',
              'description':    'descr',
              'broker_id':      'may be missing - type dependent',
              'routing_number': 'may be missing - type dependent,
              'account_type':   'may be missing - type dependent,
              'institution': {
                  # ... see :py:meth:`ofxclient.Institution.serialize`
              }
            }
  
          :rtype: nested dictionary