def differential(field, f, t=None):
    """
    Return the differential `fdt` on the function field.

    INPUT:

    - ``field`` -- function field

    - ``f``, ``t`` -- elements of the function field

    If ``t`` is not given, then return the differential `fdx` where
    `x` is the generator of the base rational function field.

    EXAMPLES::

        sage: K.<x> = FunctionField(GF(4)); _.<Y> = K[]
        sage: L.<y> = K.extension(Y^3 + x + x^3*Y)
        sage: x.differential()
        d(x)
        sage: y.differential()
        (x*y^2 + 1/x*y) d(x)
    """
    f = field(f)
    if t is not None:
        t = field(t)

    return field.space_of_differentials().element_class(field, f, t)