def validate_tail(in_tail):
    """
    Validate the --tail input
    """
    if isinstance(in_tail, int):
        return in_tail
    else:
        if in_tail == "all":
            return in_tail
        else:
            try:
                out_tail = int(in_tail)
                if out_tail > 0:
                    return out_tail
                else:
                    raise IOError("Invalid tail specified. Must be a positive integer or \"all\"")
            except ValueError:
                raise IOError("Invalid tail specified. Must be a positive integer or \"all\"")