def add_property_response(multistatusEL, href, propList):
<EOL>nsCount = <NUM_LIT:1><EOL>nsDict = {}<EOL>nsMap = {}<EOL>propDict = {}<EOL>for name, value in propList:<EOL><INDENT>status = "<STR_LIT>"<EOL>if isinstance(value, DAVError):<EOL><INDENT>status = get_http_status_string(value)<EOL>value = None<EOL><DEDENT>ns, _ = split_namespace(name)<EOL>if ns != "<STR_LIT>" and ns not in nsDict and ns != "<STR_LIT>":<EOL><INDENT>nsDict[ns] = True<EOL>nsMap["<STR_LIT>".format(nsCount)] = ns<EOL>nsCount += <NUM_LIT:1><EOL><DEDENT>propDict.setdefault(status, []).append((name, value))<EOL><DEDENT>responseEL = make_sub_element(multistatusEL, "<STR_LIT>", nsmap=nsMap)<EOL>etree.SubElement(responseEL, "<STR_LIT>").text = href<EOL>for status in propDict:<EOL><INDENT>propstatEL = etree.SubElement(responseEL, "<STR_LIT>")<EOL>propEL = etree.SubElement(propstatEL, "<STR_LIT>")<EOL>for name, value in propDict[status]:<EOL><INDENT>if value is None:<EOL><INDENT>etree.SubElement(propEL, name)<EOL><DEDENT>elif is_etree_element(value):<EOL><INDENT>propEL.append(value)<EOL><DEDENT>else:<EOL><INDENT>etree.SubElement(propEL, name).text = to_unicode_safe(value)<EOL><DEDENT><DEDENT>etree.SubElement(propstatEL, "<STR_LIT>").text = "<STR_LIT>".format(status)<EOL><DEDENT>
Append <response> element to <multistatus> element.

    <prop> node depends on the value type:
      - str or unicode: add element with this content
      - None: add an empty element
      - etree.Element: add XML element as child
      - DAVError: add an empty element to an own <propstatus> for this status code

    @param multistatusEL: etree.Element
    @param href: global URL of the resource, e.g. 'http://server:port/path'.
    @param propList: list of 2-tuples (name, value)