def METHOD_NAME(domain, file_name, use_json=False, sort_attributes=False):
    """
    Dump SDB domain to file
    """
    f = open(file_name, "w")
    if use_json:
        for item in domain:
            data = {"name": item.name, "attributes": item}
            print >> f, json.dumps(data, sort_keys=sort_attributes)
    else:
        doc = domain.to_xml(f)