def starts_with(self, prefix):
if prefix is None:<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>if isinstance(self.val, str_types):<EOL><INDENT>if not isinstance(prefix, str_types):<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>if len(prefix) == <NUM_LIT:0>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if not self.val.startswith(prefix):<EOL><INDENT>self._err('<STR_LIT>' % (self.val, prefix))<EOL><DEDENT><DEDENT>elif isinstance(self.val, Iterable):<EOL><INDENT>if len(self.val) == <NUM_LIT:0>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>first = next(iter(self.val))<EOL>if first != prefix:<EOL><INDENT>self._err('<STR_LIT>' % (self.val, prefix))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>return self<EOL>
Asserts that val is string or iterable and starts with prefix.