def get_struct_instance_field_type(obj, field_name):
    """
    :param obj: A ctypes struct instance
    :param field_name: A name of a field in the struct

    :return: The declared type of the field
    """

    for field in obj._fields_:
        current_field_name = field[0]
        if current_field_name == field_name:
            return field[1]

    raise KeyError(field_name)