import ctypes


def _args_factory(arg_names, arg_types):
    """
    Constructs a ctypes Structure with the given field names and field types.

    This is used to construct the argument struct for a Weld program.

    Parameters
    ----------

    arg_names : list of str
        Field names for the arguments.
    arg_types : list of ctypes
        Types for each field.

    Returns
    -------
    Args class
        Returns a class representing a ctypes Structure.

    """
    class Args(ctypes.Structure):
        _fields_ = list(zip(arg_names, arg_types))
    return Args