def to_int(variable):
    """Convert variable to integer or string depending on the case.

    Args:
      variable (string): a string containing a real string or an integer.

    Returns:
      variable(int, string): an integer or a string, depending on the content\
                             of variable.

    """
    try:
        return int(variable)
    except ValueError:
        return variable