def _dissect_roles(metadata):
for role_key in cnxepub.ATTRIBUTED_ROLE_KEYS:<EOL><INDENT>for user in metadata.get(role_key, []):<EOL><INDENT>if user['<STR_LIT:type>'] != '<STR_LIT>':<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>uid = parse_user_uri(user['<STR_LIT:id>'])<EOL>yield uid, role_key<EOL><DEDENT><DEDENT>raise StopIteration()<EOL>
Given a model's ``metadata``, iterate over the roles.
    Return values are the role identifier and role type as a tuple.