def METHOD_NAME(self, fstr):
    mo = self.func_regex.match(fstr)
    if not mo:
        # XXX raise exceptions
        return (None, None, None)
    dict = mo.groupdict()
    fname = dict.get('fname')
    defval = dict.get('defval')
    fname = self.strip(fname)
    defval = self.unquote(defval)
    params = None
    if fname[-1] == ')':
        # Params are present
        i = fname.rfind('(')
        if i < 0:
            raise ValueError("Missing (")
        params = fname[i + 1:-1]
        fname = fname[:i].strip()
        # Parse the params
        params = list(map(self.unquote, [_f for _f in params.split(',') if _f]))
    # Validate the function name
    if not self.funcname_regex.match(fname):
        raise ValueError("Invalid function name %s" % fname)
    return fname, params, defval