import re


def is_pep440_canonical_version(version):
    """
    Determine if the string describes a valid PEP440 canonical version specifier.

    This implementation comes directly from PEP440 itself.

    :returns: True if the version string is valid; false otherwise.
    """
    return re.match(
        (
            r'^([1-9][0-9]*!)?'
            r'(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?'
            r'(\.post(0|[1-9][0-9]*))?(\.dev(0|[1-9][0-9]*))?$'
        ),
        version
    ) is not None