parameters: (commands)
return_statement: return ids
docstring: return a list of ids corresponding to a many2many value
docstring_summary: return a list of ids corresponding to a many2many value
docstring_tokens: return a list of ids corresponding to a many2many value
function: def parse_m2m(commands):
      "return a list of ids corresponding to a many2many value"
      ids = []
      for command in commands:
          if isinstance(command, (tuple, list)):
              if command[0] in (Command.UPDATE, Command.LINK):
                  ids.append(command[1])
              elif command[0] == Command.CLEAR:
                  ids = []
              elif command[0] == Command.SET:
                  ids = list(command[2])
          else:
              ids.append(command)
      return ids
function_tokens: def parse_m2m ( commands ) : ids = [ ] for command in commands : if isinstance ( command , ( tuple , list ) ) : if command [ 0 ] in ( Command . UPDATE , Command . LINK ) : ids . append ( command [ 1 ] ) elif command [ 0 ] == Command . CLEAR : ids = [ ] elif command [ 0 ] == Command . SET : ids = list ( command [ 2 ] ) else : ids . append ( command ) return ids