def int_or_str(v):
    """Safe converts an string represent an integer to an integer or passes through none.

    :type v: Optional[str]
    :rtype: None or str or int
    """
    if v is None:
        return
    try:
        return int(v)
    except ValueError:
        return v