def prettify_seconds(seconds):
    """
    Prettifies seconds.
    Takes number of seconds (int) as input and returns a prettified string.

    Example:
    >>> prettify_seconds(342543)
    '3 days, 23 hours, 9 minutes and 3 seconds'
    """
    if seconds < 0:
        raise ValueError("negative input not allowed")
    signs = {"s": {"singular": "second", "plural": "seconds", },
             "h": {"singular": "hour", "plural": "hours"},
             "min": {"singular": "minute", "plural": "minutes"},
             "d": {"singular": "day", "plural": "days"}
            }
    seperator = ", "
    last_seperator = " and "

    def get_sign(unit, value):
        if value == 1 or value == -1:
            return signs[unit]["singular"]
        else:
            return signs[unit]["plural"]

    days, remainder = divmod(seconds, 86400)
    hours, remainder = divmod(remainder, 3600)
    minutes, seconds = divmod(remainder, 60)
    daystext = "{} {}".format(days, get_sign("d", days)) if days else ""
    hourstext = "{} {}".format(hours, get_sign("h", hours)) if hours else ""
    minutestext = "{} {}".format(minutes, get_sign("min", minutes)) if minutes else ""
    if (not seconds) and (days or hours or minutes):
        secondstext = ""
    else:
        secondstext = "{} {}".format(seconds, get_sign("s", seconds))
    output_list = [daystext, hourstext, minutestext, secondstext]
    filtered = [item for item in output_list if item]
    if len(filtered) <= 2:
        output = last_seperator.join(filtered)
    else:
        output = seperator.join(filtered[:-1]) + last_seperator + filtered[-1]
    return output