code: def _macaroon_id_ops(ops):
      '''Return operations suitable for serializing as part of a MacaroonId.
  
      It assumes that ops has been canonicalized and that there's at least
      one operation.
      '''
      id_ops = []
      for entity, entity_ops in itertools.groupby(ops, lambda x: x.entity):
          actions = map(lambda x: x.action, entity_ops)
          id_ops.append(id_pb2.Op(entity=entity, actions=actions))
      return id_opf _macaroon_id_ops(ops):
      '''Return operations suitable for serializing as part of a MacaroonId.
  
      It assumes that ops has been canonicalized and that there's at least
      one operation.
      '''
      id_ops = []
      for entity, entity_ops in itertools.groupby(ops, lambda x: x.entity):
          actions = map(lambda x: x.action, entity_ops)
          id_ops.append(id_pb2.Op(entity=entity, actions=actions))
      return id_ops
docs: Return operations suitable for serializing as part of a MacaroonId.
  
      It assumes that ops has been canonicalized and that there's at least
      one operation.