def construct_return_tuple(original_ctypes_sequence):
    """Generate a return value for queryf(), scanf(), and sscanf() out of the
    list of ctypes objects.

    :param original_ctypes_sequence: a sequence of ctypes objects, i.e. c_long,
                                     c_double, and ctypes strings.

    :returns: The pythonic variants of the ctypes objects, in a form
              suitable to be returned by a function: None if empty, single value, or
              tuple of all values.
    """

    length = len(original_ctypes_sequence)
    if length == 0:
        return None
    elif length == 1:
        return original_ctypes_sequence[0].value
    else:
        return tuple([argument.value for argument in original_ctypes_sequence])