import re


def validate_ip(line):
    """Method to check that input matches a valid IPv4 address"""
    is_valid = ""
    # RegEx to check for valid IPv4 address below.
    # Note: ^ $ ensure string matche exactly, 25[ ensures 0 - 255 range
    # ^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
    matched = re.match(
        r"^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$",
        line,
    )
    if matched:
        # matches a date and adds it to is_valid
        is_valid = matched.group()
    else:
        is_valid = "NONE"
    return is_valid