def dissect_versions(versions):
    """ Dissects version JSON returned by the API """
    version_tokens = versions.get('version', '').split('.')
    if len(version_tokens) > 1:
        (major, minor, rev) = version_tokens
    else:
        major = 0
        minor = 0
        rev = 0

    apiver_tokens = versions.get('apiversion', '').split('.')
    if len(apiver_tokens) > 1:
        (api_major, api_minor) = apiver_tokens
    else:
        api_major = 0
        api_minor = 0

    return {
        'daemon': {
            'major': major,
            'minor': minor,
            'rev': rev,
            },
        'api': {
            'major': api_major,
            'minor': api_minor,
            }
        }