'Return a list containing the roles associated with given action on given item
where item is one of Library, LibraryFolder, LibraryDatasetDatasetAssociation,
LibraryDataset, Dataset.'

def get_roles_for_action(self, item, action):

    roles = []
    for item_permission in item.actions:
        permission_action = self.get_action(item_permission.action)
        if (permission_action == action):
            roles.append(item_permission.role)
    return roles
