import socket


def get_celery_shutdown_attachment(**kwargs):
    """Create the slack message attachment for celery shutdown."""
    if kwargs["show_celery_hostname"]:
        message = "_Celery is shutting down on {}._".format(
            socket.gethostname()
        )
    else:
        message = "_Celery is shutting down._"

    attachment = {
        "attachments": [
            {
                "fallback": message,
                "color": kwargs["slack_celery_shutdown_color"],
                "text": message,
                "mrkdwn_in": ["text"]
            }
        ],
        "text": ""
    }

    return attachment