import re


def _is_valid_color(hexcolor):
    """Check if hexcolor is a valid 7-character hexadecimal color.

    BananaGUI uses this internally.

    >>> _is_valid_color('#fFffFf')
    True
    >>> _is_valid_color('#fffgff')
    False
    >>> _is_valid_color('#fff')     # consistency is needed
    False
    >>> _is_valid_color(123)
    False
    """
    if not isinstance(hexcolor, str):
        return False
    return re.search(r'^#[0-9A-Fa-f]{6}$', hexcolor) is not None