def parse_qs(s, rx, parsef=None, length=2, quote=False):
    '''helper for parsing a string that can both rx or parsef
       which is obstensibly the parsef for rx.

       Use parse colors for color tuples. This won't work with
       those.
    '''
    if type(rx) != str:
        rx = rx.pattern;
    if re.match(" *\(.*\)", s):
        if not parsef:
            if parse_utuple(s,rx,length=length):
                if quote:
                    s=quote_subs(s);
                return evalt(s);
            else:
                raise ValueError("{} did is not a valid tuple of {}".format(
                    s, rx));
        else:
            return parsef(s,length=length);
    elif re.match('^ *{} *$'.format(rx), s):
        if quote:
            return eval('["{}"]'.format(s));
        return eval('[{}]'.format(s));
    else:
        raise ValueError("{} does not match '{}' or the passed parsef".format(
            s,rx));