def string_is_hex(color_str):
    """
    Returns whether or not given string is a valid hexadecimal string
    :param color_str: str
    :return: bool
    """
    if color_str.startswith('#'):
        return len(color_str) in (4, 7, 9)
    else:
        return len(color_str) in (3, 6, 8)
