def retrymethod(count, sleep=0):
    """
    Defines a decorator method to wrap a method with a retry mechanism.  The
    wrapped method will be attempt to be called the given number of times based
    on the count value, waiting the number of seconds defined by the sleep
    parameter.  If the throw option is defined, then the given error will
    be thrown after the final attempt fails.
    
    :param      count | <int>
                sleep | <int> | msecs
    """

    def decorated(func):
        @wraps(func)
        def wrapped(*args, **kwds):
            # do the retry options
            for i in range(count - 1):
                try:
                    return func(*args, **kwds)
                except StandardError:
                    pass

                if sleep:
                    time.sleep(sleep)

            # run as standard
            return func(*args, **kwds)

        return wrapped

    return decorated