def transform_int(val, base=None, mode=None):
    """
    Transform to an int with optional base notation
        <dotted>|int                int(val)
        <dotted>|int:<base>         int(val, base=<base>)
        <dotted>|int::force         int(val) or raises
    """
    try:
        return int(val, base=base or 10)
    except (ValueError, TypeError):
        if mode == 'force':
            raise
    return val