def _format(s, *args, **kwargs):
    """Safely format string ``s``.

    Returns ``s.format(*args, **kwargs)`` if no exception is thrown, otherwise
    ``s``.
    """
    try:
        return s.format(*args, **kwargs)
    except (IndexError, KeyError):
        return s
