def _check_ogrn(ogrn):
    """Validates OGRN code"""
    if not ogrn:
        return False
    if len(ogrn) == 13:
        delimeter = 11
    elif len(ogrn) == 15:
        delimeter = 13
    else:
        return False
    main_part = int(ogrn[:-1]) % delimeter % 10
    checksum = int(ogrn[-1])

    return main_part == checksum