def dtype_eq(x, dtype):
    """
    >>> dtype_eq("hogehoge",None)
    True
    >>> dtype_eq("hogehoge",tf.float32)
    False
    >>> dtype_eq(tf.zeros([1,2,3],dtype=tf.float32),tf.float32)
    True
    """
    if dtype == None:
        return True
    elif not hasattr(x, 'dtype'):
        return False
    else:
        return x.dtype == dtype
