def docker_client_version():
    """Try and extract the client version from the User-Agent string

    So we can warn older versions of the Docker engine/daemon about
    incompatible APIs.  If we can't figure out the version (e.g. the
    client is not a Docker engine), just return None.
    """
    ua = flask.request.headers.get('user-agent', '')
    m = _re_docker_version.search(ua)
    if not m:
        return
    version = m.group(1)
    if '-' in version:
        version = version.split('-')[0]
    try:
        return tuple(int(x) for x in version)
    except ValueError:
        return
Try and extract the client version from the User-Agent string

    So we can warn older versions of the Docker engine/daemon about
    incompatible APIs.  If we can't figure out the version (e.g. the
    client is not a Docker engine), just return None.
    
docker_registry/toolkit.py