'Return a mapping of id to usage count for all values of the specified
field, which must be a many-one or many-many field.'

@read_api
def get_usage_count_by_id(self, field):

    try:
        return {k: len(v) for (k, v) in self.fields[field].table.col_book_map.iteritems()}
    except AttributeError:
        raise ValueError((u'%s    is    not    a    many-one    or    many-many    field' % field))
