def _context_string_to_dict(context):
 if (not re.match('[^:]+:[^:]+:[^:]+:[^:]+$', context)):
  raise SaltInvocationError(('Invalid SELinux context string: {0}. ' + 'Expected "sel_user:sel_role:sel_type:sel_level"'))
 context_list = context.split(':', 3)
 ret = {}
 for (index, value) in enumerate(['sel_user', 'sel_role', 'sel_type', 'sel_level']):
  ret[value] = context_list[index]
 return ret

def _context_string_to_dict ( context ) : if ( not re . match ( '[^:]+:[^:]+:[^:]+:[^:]+$' , context ) ) : raise SaltInvocationError ( ( 'Invalid SELinux context string: {0}. ' + 'Expected "sel_user:sel_role:sel_type:sel_level"' ) ) context_list = context . split ( ':' , 3 ) ret = { } for ( index , value ) in enumerate ( [ 'sel_user' , 'sel_role' , 'sel_type' , 'sel_level' ] ) : ret [ value ] = context_list [ index ] return ret
converts an selinux file context from string to dict .