<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_backend_stats_url(config, hub, backend_type):
 """ Util method to get backend stats url """

    if ((config is not None) and ('hub' in config) and (hub is None)):
        hub = config["hub"]
    if (hub is not None):
        return '/Network/{}/devices/{}'.format(hub, backend_type)
    return '/Backends/{}'.format(backend_type)