def format_string(string, *args, **kwargs):
    """
    Format text inserting parameters in the wildcard positions.

    There are two different syntax for string formatting. The first is based
    on C and uses symbols such as %s, %f, %d to delimit insertion points.

    >>> format_string('%i != %.2f', 42, 43)
    '42 != 43.00'

    The second uses curly braces.

    >>> format_string('{0} != {1}', 42, 43)
    '42 != 43'
    """
    try:
        return string % args
    except TypeError:
        return string.format(*args, **kwargs)
