def validate(adr, servicelevel=1):
    """Validates an address and returns a possibly corrected address.

    'adr' should be a object conforming to the address protocol
        - see http://cybernetics.hudora.biz/projects/wiki/AddressProtocol
    'servicelevel' can be an integer with the following values:
    1 - generic validation, no money/effort should be spend on correction and suggestions
    2 - TBD.

    returns (status, message, [corrected addresses and variants])

    status can be:
    '10invalid' - address is for sure non deliverable in this form
    '20troubled' - bounced before or is unlikely to be correct - possible alternatives are returned
    '30ok' - likely to work
    '31ok' - likely to work but was corrected
    '40verified' - we are sure it works
    """
    adr['land'] = adr['land'].strip()
    adr['plz'] = adr['plz'].strip()
    if adr['land'] != 'IE' and not adr['plz']:
        return '10invalid', 'Postleitzahl fehlt', [adr]
    if adr['land'] == 'DE' and len(adr.get('plz', '')) != 5:
        return '10invalid', 'Postleitzahl fehlerhaft', [adr]
    return '30ok', '', [adr]
