def relicResult(relicFunc, resultType, *args):
    """
    Calls @relicFunc with a list of @args that are passed by reference. If
    @resultType is set, a new object of this type is created, passed as the
    first argument, and returned by this function.
    """
    result = None

    # If there is a return type, it becomes the first parameter.
    if resultType is not None:
        result = resultType()
        args = (result,) + args

    # Pass all parameters byref
    params = [byref(x) for x in list(args)]

    # Call the function and return our result.
    relicFunc(*params)
    return result