def _IsHashable(target):
    """Returns True if the target is hashable."""
    if not hasattr(target, '__hash__') or not target.__hash__:
        return False
    try:
        hash(target)
    except (TypeError, ValueError):
        return False
    return True
