def format_callback_to_string(callback, args=None, kwargs=None):
    """
    Convert a callback, its arguments and keyword arguments to a string suitable for logging purposes

    :param ~collections.abc.Callable,str callback:
        The callback function
    :param list,tuple args:
        The callback arguments
    :param dict kwargs:
        The callback keyword arguments
    :rtype: str
    """
    if not isinstance(callback, str):
        try:
            callback_str = "{}(".format(callback.__qualname__)
        except AttributeError:
            callback_str = "{}(".format(callback.__name__)
    else:
        callback_str = "{}(".format(callback)
    if args:
        callback_str += ", ".join([repr(arg) for arg in args])
    if kwargs:
        callback_str += ", ".join(["{}={!r}".format(k, v) for (k, v) in kwargs.items()])
    callback_str += ")"
    return callback_str