(struct)
return dict(list(map(get_pair, struct._fields_)))
take a ctypes.Structure and return its field/value pairs
    as a dict.
    >>> 'buttons' in struct_dict(XINPUT_GAMEPAD)
    True
    >>> struct_dict(XINPUT_GAMEPAD)['buttons'].__class__.__name__
    'CField'
take a ctypes.Structure and return its field/value pairs
    as a dict.
    >>> 'buttons' in struct_dict(XINPUT_GAMEPAD)
    True
    >>> struct_dict(XINPUT_GAMEPAD)['buttons'].__class__.__name__
    'CField'
take a ctypes . Structure and return its field / value pairs as a dict . >>> buttons in struct_dict ( XINPUT_GAMEPAD ) True >>> struct_dict ( XINPUT_GAMEPAD ) [ buttons ] . __class__ . __name__ CField
def struct_dict(struct):
    """
    take a ctypes.Structure and return its field/value pairs
    as a dict.
    >>> 'buttons' in struct_dict(XINPUT_GAMEPAD)
    True
    >>> struct_dict(XINPUT_GAMEPAD)['buttons'].__class__.__name__
    'CField'
    """
    get_pair = lambda field_type: (
        field_type[0], getattr(struct, field_type[0]))
    return dict(list(map(get_pair, struct._fields_)))
def struct_dict ( struct ) : get_pair = lambda field_type : ( field_type [ 0 ] , getattr ( struct , field_type [ 0 ] ) ) return dict ( list ( map ( get_pair , struct . _fields_ ) ) )