def prepare(query, params):
    """
    For every match of the form ":param_name", call marshal
    on kwargs['param_name'] and replace that section of the query
    with the result
    """
    def repl(match):
        name = match.group(1)[1:]
        if name in params:
            return marshal(params[name])
        return ":%s" % name

    new, count = re.subn(_param_re, repl, query)

    if len(params) > count:
        raise cql.ProgrammingError("More keywords were provided "
                                   "than parameters")
    return new
For every match of the form ":param_name", call marshal
    on kwargs['param_name'] and replace that section of the query
    with the result