def set_lock(<EOL>self,<EOL>path,<EOL>owner,<EOL>lock_type="<STR_LIT>",<EOL>lock_scope="<STR_LIT>",<EOL>depth=None,<EOL>headers=None,<EOL>):
root = ElementTree.Element("<STR_LIT>")<EOL>object_to_etree(<EOL>root,<EOL>{"<STR_LIT>": lock_type, "<STR_LIT>": lock_scope, "<STR_LIT>": {"<STR_LIT>": owner}},<EOL>namespace="<STR_LIT>",<EOL>)<EOL>tree = ElementTree.ElementTree(root)<EOL>if headers is None:<EOL><INDENT>headers = {}<EOL><DEDENT>if depth is not None:<EOL><INDENT>headers["<STR_LIT>"] = depth<EOL><DEDENT>headers["<STR_LIT:Content-Type>"] = '<STR_LIT>'<EOL>headers["<STR_LIT>"] = "<STR_LIT>"<EOL>body = self._tree_to_binary_body(tree)<EOL>self._request("<STR_LIT>", path, body=body, headers=headers)<EOL>locks = self.response.tree.findall("<STR_LIT>")<EOL>lock_list = []<EOL>for lock in locks:<EOL><INDENT>lock_list.append(lock[<NUM_LIT:0>].text.strip().strip("<STR_LIT:\n>"))<EOL><DEDENT>return lock_list<EOL>
Set a lock on a dav resource