'Generate a group of peewee models analagous to the provided Django
models for the purposes of creating queries.
:param model: A Django model class.
:param options: A dictionary of options, see note below.
:returns: A dictionary mapping model names to peewee model classes.
:rtype: dict
Recognized options:
`recurse`: Follow foreign keys (default: True)
`max_depth`: Max depth to recurse (default: None, unlimited)
`backrefs`: Follow backrefs (default: False)
`exclude`: A list of models to exclude
Example::
# Map Django models to peewee models. Foreign keys and M2M will be
# traversed as well.
peewee = translate(Account)
# Generate query using peewee.
PUser = peewee[\'User\']
PAccount = peewee[\'Account\']
query = (PUser
.select()
.join(PAccount)
.where(PAccount.acct_type == \'foo\'))
# Django raw query.
users = User.objects.raw(*query.sql())'

def translate_models(self, *models, **options):

    mapping = AttrDict()
    recurse = options.get('recurse', True)
    max_depth = options.get('max_depth', None)
    backrefs = options.get('backrefs', False)
    exclude = options.get('exclude', None)
    if ((not recurse) and max_depth):
        raise ValueError('Error,    you    cannot    specify    a    max_depth    when    recurse=False.')
    elif (not recurse):
        max_depth = 0
    elif (recurse and (max_depth is None)):
        max_depth = (-1)
    for model in models:
        self._translate_model(model, mapping, max_depth=max_depth, backrefs=backrefs, exclude=exclude)
    return mapping
