def color(self, value):
assert self._is_domain_set,"<STR_LIT>"<EOL>if self._ctype == <NUM_LIT:2>:<EOL><INDENT>try:<EOL><INDENT>return self._colors[self._domain.index(value)]<EOL><DEDENT>except ValueError:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>" % str(value) +<EOL>"<STR_LIT>" % "<STR_LIT:;>".join(map(str, self._domain))<EOL>)<EOL><DEDENT><DEDENT>if value < self._domain[<NUM_LIT:0>]:<EOL><INDENT>return self._colors[<NUM_LIT:0>]<EOL><DEDENT>if value > self._domain[-<NUM_LIT:1>]:<EOL><INDENT>return self._colors[-<NUM_LIT:1>]<EOL><DEDENT>for count, d in enumerate(self._domain):<EOL><INDENT>if d <= value <= self._domain[count + <NUM_LIT:1>]:<EOL><INDENT>if self._ctype == <NUM_LIT:0>:<EOL><INDENT>return self._cal_color(value, count)<EOL><DEDENT>if self._ctype == <NUM_LIT:1>:<EOL><INDENT>return self._colors[count + <NUM_LIT:1>]<EOL><DEDENT><DEDENT><DEDENT>
Return color for an input value.