def update_filter(argname, cdict, callargs):
    """ Updates a mongo query to include self.composer_id.
    If _filter is None, we just use the cdict's update_filter kwargs
    If _filter is a dict and doesn't include composer_id, we add it in
    If _filter is not a dict, we assume it's a spec for the _id

    Modifies the callargs argument, but also returns the new callargs
    """
    filter_kwargs = cdict.get('update_filter') or {}
    _filter = callargs[argname]
    for k, v in filter_kwargs.iteritems():
        if _filter is None:
            _filter = {k: v}
        elif isinstance(_filter, dict):
            _filter[k] = _filter.get(k, v)
        else:
            _filter = {'_id': _filter, k: v}
    callargs[argname] = _filter
    return callargs
