You are a helpful, respectful, and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
What is Polystyrene sulfonate and explain in detail?
Polystyrene sulfonates are a group of medications used to treat high blood potassium. Effects generally take hours to days. They are also used to remove potassium, calcium, and sodium from solutions in technical applications.
Common side effects include loss of appetite, gastrointestinal upset, constipation, and low blood calcium. These polymers are derived from polystyrene by the addition of sulfonate functional groups.
Sodium polystyrene sulfonate was approved for medical use in the United States in 1958.A polystyrene sulfonate was developed in the 2000s to treat Clostridium difficile associated diarrhea under the name Tolevamer, but it was never marketed.

Medical uses
Polystyrene sulfonate is usually supplied in either the sodium or calcium form.  It is used as a potassium binder in acute and chronic kidney disease for people with hyperkalemia (abnormal high blood serum potassium levels).  However, it is unclear if it is beneficial and there is concern about possible side effects when it is combined with sorbitol.Polystyrene sulfonates are given by mouth with a meal or rectally by retention enema.

Side effects
Intestinal disturbances are common, including loss of appetite, nausea, vomiting, and constipation. In rare cases, it has been associated with colonic necrosis. Changes in electrolyte blood levels such as hypomagnesemia, hypocalcemia, and hypokalemia may occur. Polystyrene sulfonates should not be used in people with obstructive bowel disease and in newborns with reduced gut motility.

Intestinal injury
A total of 58 cases of intestinal injury including necrosis of the colon have been reported with polystyrene sulfonate as of 2013. Well more cases have been reported when used in combination  with sorbitol and other cases have occurred when used alone.

Interactions
Polystyrene sulfonates can bind to various drugs within the digestive tract and thus lower their absorption and effectiveness. Common examples include lithium, thyroxine, and digitalis. In September 2017, the FDA recommended separating the dosing of polystyrene sulfonate from any other oral medications by at least three hours to avoid any potential interactions.

Mechanism of action
Hyperkalemia
Polystyrene sulfonates release sodium or calcium ions in the stomach in exchange for hydrogen ions. When the resin reaches the large intestine the hydrogen ions are exchanged for free potassium ions; the resin is then eliminated in the feces. The net effect is lowering the amount of potassium available for absorption into the blood and increasing the amount that is excreted via the feces. The effect is a reduction of potassium levels in the body, at a capacity of 1 mEq of potassium exchanged per 1 g of resin.

Production and chemical structure
Polystyrene sulfonic acid, the acid whose salts are the polystyrene sulfonates, has the idealized formula (CH2CHC6H4SO3H)n.  The material is prepared by sulfonation of polystyrene:

(CH2CHC6H5)n  +  n SO3   →   (CH2CHC6H4SO3H)nSeveral methods exist for this conversion, which can lead to varying degree of sulfonation.  Usually the polystyrene is crosslinked, which keeps the polymer from dissolving