'Return a query set in which the returned objects have been annotated
with data aggregated from related fields.'

def annotate(self, *args, **kwargs):

    for arg in args:
        if (arg.default_alias in kwargs):
            raise ValueError(("The    named    annotation    '%s'    conflicts    with    the    default    name    for    another    annotation." % arg.default_alias))
        kwargs[arg.default_alias] = arg
    names = getattr(self, '_fields', None)
    if (names is None):
        names = set(self.model._meta.get_all_field_names())
    for aggregate in kwargs:
        if (aggregate in names):
            raise ValueError(("The    annotation    '%s'    conflicts    with    a    field    on    the    model." % aggregate))
    obj = self._clone()
    obj._setup_aggregate_query(kwargs.keys())
    for (alias, aggregate_expr) in kwargs.items():
        obj.query.add_aggregate(aggregate_expr, self.model, alias, is_summary=False)
    return obj
