def valid_imo(imo=0):
    """Check valid IMO using checksum.

    Arguments
    ---------
    imo : integer
        An IMO ship identifier

    Returns
    -------
    True if the IMO number is valid

    Notes
    -----
    Taken from Eoin O'Keeffe's `checksum_valid` function in pyAIS
    """
    try:
        str_imo = str(int(imo))
        if len(str_imo) != 7:
            return False
        sum_val = 0
        for ii, chk in enumerate(range(7, 1, -1)):
            sum_val += chk * int(str_imo[ii])
        if str_imo[6] == str(sum_val)[len(str(sum_val))-1]:
            return True
    except:
        return False
    return False