import re


def is_hex(in_col):
    """
    Check whether an input string is a valid hex value.
    Return True if it is, otherwise False.
    """
    if type(in_col) is not str:
        return False

    regular_expression = re.compile(
        r"""^  # match beginning of string
        [#]?  # exactly one hash, but optional
        [0-9a-fA-F]{6}  # exactly six of the hex symbols 0 to 9, a to f
        $  # match end of string
        """,
        re.VERBOSE | re.MULTILINE,
    )

    if regular_expression.match(in_col) == None:
        return False
    else:
        return True