I have the following code to generate a poset in which the order is given by the refinement.
sage: elms = M sage: def fcn(A, B): ....: if len(A) != len(B)