Safely calls the method with the given methname on the given
    object.  Remaining positional and keyword arguments are passed to
    the method.  The return value is None, if the method is not
    available, or the return value of the method.

def _safe_call(obj, methname, *args, **kwargs):
    """
    Safely calls the method with the given methname on the given
    object.  Remaining positional and keyword arguments are passed to
    the method.  The return value is None, if the method is not
    available, or the return value of the method.
    """

    meth = getattr(obj, methname, None)
    if meth is None or not callable(meth):
        return

    return meth(*args, **kwargs)