At some point, many of us have thought about when, where and how we might die.
It is comforting to imagine a peaceful death at home surrounded by our close family and friends.
But often a death is in a hospital, which can cause problems for dying patients and their family.
Rites important to faiths, such as bedside vigils and prayers or washing the body can be difficult in a crowded ward.
Sikhs, for instance, do not believe hair should be cut even after death and Hindu patients like to have the leaves of the sacred Tulsi plant and Ganges water placed in their mouth by relatives before death.
Jews like to keep a vigil with the dying, and at death Muslims like the body to be wrapped in one or two plain white sheets and the bed turned to face Mecca.
But while some hospitals have been very accommodating in the past, others have not.
Now guidance from the General Medical Council (GMC) aims to ensure that, where possible, a patient gets their last rites by encouraging doctors to ask them, or their family what they want.
Care after death
The GMC's Sharon Burton said the guidance was vital.
"It asks doctors to be ready to explore these personal issues as part of a wider and ongoing conversation, to build up a picture of what is likely to be important to the patient and their family, and to plan in advance what care they may want towards the end of life.
"A doctor has to be guided by what is clinically appropriate in treating the patient, whilst doing their best to take account of the wishes and preferences of the patient.
"The guidance also explains that a doctor's responsibilities do not end after a patient dies. Handling a body is a hugely sensitive subject, particularly in certain faiths and cultures."
She added: "Doctors may be more inclined to prioritise their living patients, but this does not mean that they can neglect the needs of grieving relatives. How doctors provide care after a patient dies can have a long lasting effect on a bereaved partner and other family."
A spokesman for the British Medical Association agreed that doctors need to be sensitive even after death.
"It is right that when possible, doctors and hospitals try and accommodate religious or cultural needs.
"This not only relates to treatment at the end of life but also to the care of the body once the patient has died."
And Eve Richardson, chief executive of National Council of Palliative Care and the Dying Matters Coalition, said the guidance should open dialogue on dying, encouraging patients and medics to talk.
Rituals not magic
Dr David Albert Jones, director of the Anscombe Bioethics Centre in Oxford, helped draw up the GMC guidelines. He said providing this level of care was very important and had sometimes been lacking.
"Religious rituals are not magic but make sense within the practice and belief of particular traditions," he said.
"For example, a Catholic priest anoints with oil to strengthen someone either for recovery or for their final journey.
"In the past this has not always been handled very well. Health care professionals have not distinguished the general need of patients for spiritual support from the specific practices of religious believers.
"They have therefore underestimated people's human, spiritual and religious needs."