u'''Parse and execute single line of a readline init file.

def parse_and_bind(self, string):
        u'''Parse and execute single line of a readline init file.'''
        try:
            log(u'parse_and_bind("%s")' % string)
            if string.startswith(u'#'):
                return
            if string.startswith(u'set'):
                m = re.compile(ur'set\s+([-a-zA-Z0-9]+)\s+(.+)\s*$').match(string)
                if m:
                    var_name = m.group(1)
                    val = m.group(2)
                    try:
                        setattr(self.mode, var_name.replace(u'-',u'_'), val)
                    except AttributeError:
                        log(u'unknown var="%s" val="%s"' % (var_name, val))
                else:
                    log(u'bad set "%s"' % string)
                return
            m = re.compile(ur'\s*(.+)\s*:\s*([-a-zA-Z]+)\s*$').match(string)
            if m:
                key = m.group(1)
                func_name = m.group(2)
                py_name = func_name.replace(u'-', u'_')
                try:
                    func = getattr(self.mode, py_name)
                except AttributeError:
                    log(u'unknown func key="%s" func="%s"' % (key, func_name))
                    if self.debug:
                        print u'pyreadline parse_and_bind error, unknown function to bind: "%s"' % func_name
                    return
                self.mode._bind_key(key, func)
        except:
            log(u'error')
            raise