def METHOD_NAME(cls, prefix, try_count=1, max_tries=1000):
    if try_count >= max_tries:
        raise RuntimeError(
            f'a unique API key could not be found after {max_tries} tries'
        )
    key = f'{prefix}{random.randint(0, 999)}'
    if cls.objects.filter(key=key).exists():
        return cls.METHOD_NAME(
            prefix, try_count=try_count + 1, max_tries=max_tries
        )
    return key