def length_error_message(identifier, min_length=None, max_length=None):
    """Build length error message."""

    additional = []

    if min_length:
        additional.append('at least length {}'.format(min_length))

    if max_length:
        additional.append('at most length {}'.format(max_length))

    body = ', '.join(additional)
    message = '{} identifier input must {}.'.format(identifier, body)

    return message