def to_int(s, default=None):
    """Convert and arbitrary input to `int`.

    Try to convert and arbitrary input to `int` and use a fallback value
    (`default`) if it is not possible.

    """

    try:
        return int(s)
    except (ValueError, TypeError):
        return default