def limits(self, value, square=False):
if isinstance(value, six.string_types):<EOL><INDENT>import re<EOL>match = re.match(r"<STR_LIT>", value)<EOL>if match is None:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>value, type = match.groups()<EOL>import ast<EOL>value = ast.literal_eval(value)<EOL>type = type.strip()<EOL>if type in ["<STR_LIT:s>", "<STR_LIT>"]:<EOL><INDENT>return self.limits_sigma(value)<EOL><DEDENT>elif type in ["<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>return self.limits_sigma(value, square=True)<EOL><DEDENT>elif type in ["<STR_LIT:%>", "<STR_LIT>"]:<EOL><INDENT>return self.limits_percentage(value)<EOL><DEDENT>elif type in ["<STR_LIT:%s>", "<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>return self.limits_percentage(value, square=True)<EOL><DEDENT><DEDENT><DEDENT>if value is None:<EOL><INDENT>return self.limits_percentage(square=square)<EOL><DEDENT>else:<EOL><INDENT>return value<EOL><DEDENT>
TODO: doc + server side implementation