def format_zip(field):
    """Return str version of 5 digit zip. Examples:

        format_zip('08544-4320') >>> '08544'
        format_zip('085444320') >>> '08544'
        format_zip(85444320) >>> '08544'
        format_zip(851) >>> '00851'

    :param field: raw text
    """
    if field is None or not field:
        return None
    field = str(field).split('-')[0].split(' ')[0].split('.')[0]
    if len(field) <= 5:
        return field.zfill(5) if field.isdigit() else None
    elif len(field) <= 9:
        field = field.zfill(9)[:5]
        return field if field.isdigit() else None
    return None