def get_workdir_data(project_doc, asset_doc, task_name, host_name):
    """Prepare data for workdir template filling from entered information.

    Args:
        project_doc (dict): Mongo document of project from MongoDB.
        asset_doc (dict): Mongo document of asset from MongoDB.
        task_name (str): Task name for which are workdir data preapred.
        host_name (str): Host which is used to workdir. This is required
            because workdir template may contain `{app}` key.

    Returns:
        dict: Data prepared for filling workdir template.
    """
    hierarchy = "/".join(asset_doc["data"]["parents"])

    data = {
        "project": {
            "name": project_doc["name"],
            "code": project_doc["data"].get("code")
        },
        "task": task_name,
        "asset": asset_doc["name"],
        "app": host_name,
        "hierarchy": hierarchy
    }
    return data