def resolve_allowed_tags(model_obj, tags_curr, tags_new, request_user=AnonymousUser):
 ns_tags_curr = parse_tag_namespaces(tags_curr)
 ns_tags_new = parse_tag_namespaces(tags_new)
 all_ns = set((ns_tags_curr.keys() + ns_tags_new.keys()))
 tags_out = []
 for ns in all_ns:
  if model_obj.allows_tag_namespace_for(ns, request_user):
   if (ns in ns_tags_new):
    tags_out.extend(ns_tags_new[ns])
  elif (ns in ns_tags_curr):
   tags_out.extend(ns_tags_curr[ns])
 return tags_out

def resolve_allowed_tags ( model_obj , tags_curr , tags_new , request_user = AnonymousUser ) : ns_tags_curr = parse_tag_namespaces ( tags_curr ) ns_tags_new = parse_tag_namespaces ( tags_new ) all_ns = set ( ( ns_tags_curr . keys ( ) + ns_tags_new . keys ( ) ) ) tags_out = [ ] for ns in all_ns : if model_obj . allows_tag_namespace_for ( ns , request_user ) : if ( ns in ns_tags_new ) : tags_out . extend ( ns_tags_new [ ns ] ) elif ( ns in ns_tags_curr ) : tags_out . extend ( ns_tags_curr [ ns ] ) return tags_out
given a new set of tags and a user .