def formfield_for_foreignkey_helper(inline, *args, **kwargs):
    """
    The implementation for ``RelatedContentInline.formfield_for_foreignkey``

    This takes the takes all of the ``args`` and ``kwargs`` from the call to
    ``formfield_for_foreignkey`` and operates on this.  It returns the updated
    ``args`` and ``kwargs`` to be passed on to ``super``.

    This is solely an implementation detail as it's easier to test a function
    than to provide all of the expectations that the ``GenericTabularInline``
    has.
    """
    db_field = args[0]
    if db_field.name != "related_type":
        return args, kwargs

    initial_filter = getattr(settings, RELATED_TYPE_INITIAL_FILTER,
            False)
    if "initial" not in kwargs and initial_filter:
        # TODO: handle gracefully if unable to load and in non-debug
        initial = RelatedType.objects.get(**initial_filter).pk
        kwargs["initial"] = initial
    return args, kwargs