def get_unique_or_none(klass, *args, **kwargs):
    """ Returns a unique instance of `klass` or None """
    try:
        return klass.objects.get(*args, **kwargs)
    except klass.DoesNotExist:
        return None
    except klass.MultipleObjectsReturned:
        return None
    return None
Returns a unique instance of `klass` or None