def to_dict(self):
        """
        This method converts the DictCell into a python `dict`.  This is useful
        for JSON serialization.
        """
        output = {}
        for key, value in self.__dict__['p'].iteritems():
            if value is None or isinstance(value, SIMPLE_TYPES):
                output[key] = value
            elif hasattr(value, 'to_dot'):
                output[key] = value.to_dot()
            elif hasattr(value, 'to_dict'):
                output[key] = value.to_dict()
            elif isinstance(value, datetime.date):
                # Convert date/datetime to ms-since-epoch ("new Date()").
                ms = time.mktime(value.utctimetuple()) * 1000
                ms += getattr(value, 'microseconds', 0) / 1000
                output[key] = int(ms)
            elif isinstance(value, dict):
                output[key] = []
            else:
                raise ValueError('cannot encode ' + repr(key))

        return output
def to_dict ( self ) : output = { } for key , value in self . __dict__ [ 'p' ] . iteritems ( ) : if value is None or isinstance ( value , SIMPLE_TYPES ) : output [ key ] = value elif hasattr ( value , 'to_dot' ) : output [ key ] = value . to_dot ( ) elif hasattr ( value , 'to_dict' ) : output [ key ] = value . to_dict ( ) elif isinstance ( value , datetime . date ) : ms = time . mktime ( value . utctimetuple ( ) ) * 1000 ms += getattr ( value , 'microseconds' , 0 ) / 1000 output [ key ] = int ( ms ) elif isinstance ( value , dict ) : output [ key ] = [ ] else : raise ValueError ( 'cannot encode ' + repr ( key ) ) return output
This method converts the DictCell into a python `dict`.  This is useful
        for JSON serialization.