def coerce_int(obj):
    """Return string converted to integer.

    .. Usage::

        >>> coerce_int(49)
        49

        >>> coerce_int('49')
        49

        >>> coerce_int(43.22)
        43
    """
    try:
        return int(obj) if obj else obj
    except ValueError:
        return 0