def instanceof(s, instance='int'):
    """Verifies if a string is an instance of other primary type.

    Keyword arguments:
    s -- String.
    instance -- the instance type. (default "int")

    Returns:
    True if string s is an instance of the given type and False if it is not.
    """
    try:
        if instance == 'int':
            int(s)
        elif instance == 'float':
            float(s)
        return True
    except (TypeError, ValueError):
        return False
