Your task is to write a program or function that checks if a string is a valid URL.
Given a string as input, you will output a truthy value if the input is a valid URL. If it is not, output a falsey value. An input string is considered a valid URL if all of the following criteria are met:
- Begins with
- At least one and up to 128 labels (parts of URL delimited by a period)
- Labels delimited by a period
- Contain only letters, digits, and hyphens
- Do not start nor end with a hyphen
- Third and fourth characters cannot be a hyphen, unless the first two characters are 'xn'
- A label may contain zero to 63 characters
- The length of the string does not exceed 253 characters
This is a code-golf, with standard rules.