#NEWLINE# def create( root , subkey = '' , sec = None ) : #NEWLINE# #INDENT# 'Create a key and apply specific security to it, returning the\n    key created. Note that a colon in the key name is treated as part\n    of the name not as a value indicator. Any parts of the path not\n    already existing will be created as needed::\n\n        from winsys import registry, security\n        sec = security.Security(dacl=[("", "F", "ALLOW")])\n        registry.create(r"hklm\\software\\winsys\test", sec=sec)\n        registry.registry(r"hklm\\software\\winsys\test").dump()\n\n    :param root: anything accepted by :func:`registry`\n    :param subkey: anything accepted by :meth:`Registry.get_key`\n    :param sec: a :class:`security.Security` instance or None\n    :returns: a :class:`Registry` object for `root`\n    ' #NEWLINE# key = registry ( root , accept_value = False ) . get_key ( subkey ) #NEWLINE# ( computer0 , root0 , path0 , value0 ) = _parse_moniker ( key . moniker , accept_value = False ) #NEWLINE# parts = path0 . split ( sep ) #NEWLINE# for ( i , part ) in enumerate ( parts ) : #NEWLINE# #INDENT# ( computer , root , path , value ) = _parse_moniker ( create_moniker ( computer0 , root0 , sep . join ( parts [ : ( computer + 1 ) ] ) ) , accept_value = False ) #NEWLINE# if computer : #NEWLINE# #INDENT# hRoot = wrapped ( win32api . RegConnectRegistry , computer , root ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# hRoot = root #NEWLINE# #UNINDENT# wrapped ( win32api . RegCreateKeyEx , Key = hRoot , SubKey = path , samDesired = Registry . _access ( Registry . DEFAULT_ACCESS ) , SecurityAttributes = ( sec . pyobject ( ) if sec else None ) ) #NEWLINE# #UNINDENT# return key