def wrapped_object(self, LayoutClass, fields, *args, **kwargs):
if args:<EOL><INDENT>if isinstance(fields, list):<EOL><INDENT>fields = tuple(fields)<EOL><DEDENT>else:<EOL><INDENT>fields = (fields,)<EOL><DEDENT>if LayoutClass in self.args_first:<EOL><INDENT>arguments = args + fields<EOL><DEDENT>else:<EOL><INDENT>arguments = fields + args<EOL><DEDENT>return LayoutClass(*arguments, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>if isinstance(fields, list):<EOL><INDENT>return LayoutClass(*fields, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>return LayoutClass(fields, **kwargs)<EOL><DEDENT><DEDENT>
Returns a layout object of type `LayoutClass` with `args` and `kwargs` that
wraps `fields` inside.