'Given a value this runs it properly through the type system.
This automatically handles things like `nargs` and `multiple` as
well as composite types.'

def type_cast_value(self, ctx, value):

    if self.type.is_composite:
        if (self.nargs <= 1):
            raise TypeError(('Attempted    to    invoke    composite    type    but    nargs    has    been    set    to    %s.        This    is    not    supported;    nargs    needs    to    be    set    to    a    fixed    value    >    1.' % self.nargs))
        if self.multiple:
            return tuple((self.type((x or ()), self, ctx) for x in (value or ())))
        return self.type((value or ()), self, ctx)
    def _convert(value, level):
        if (level == 0):
            return self.type(value, self, ctx)
        return tuple((_convert(x, (level - 1)) for x in (value or ())))
    return _convert(value, ((self.nargs != 1) + bool(self.multiple)))
