def permissions_string(permissions, known_permissions):
 to_set = []
 if (permissions is None):
  to_set = ['+all']
 else:
  to_set = ['-all']
  omitted = sorted((known_permissions - set(permissions)))
  to_set.extend(('-{}'.format(x) for x in omitted))
  to_set.extend(('+{}'.format(x) for x in permissions))
 return ','.join(to_set)

def permissions_string ( permissions , known_permissions ) : to_set = [ ] if ( permissions is None ) : to_set = [ '+all' ] else : to_set = [ '-all' ] omitted = sorted ( ( known_permissions - set ( permissions ) ) ) to_set . extend ( ( '-{}' . format ( x ) for x in omitted ) ) to_set . extend ( ( '+{}' . format ( x ) for x in permissions ) ) return ',' . join ( to_set )
return a comma separated string of permission changes .