def _get_entref(bpe):
        """Returns the entity reference of an entity if it exists or
        return the entity reference that was passed in as argument."""
        if not _is_reference(bpe):
            try:
                er = bpe.getEntityReference()
            except AttributeError:
                return None
            return er
        else:
            return bpe
def _get_entref ( bpe ) : if not _is_reference ( bpe ) : try : er = bpe . getEntityReference ( ) except AttributeError : return None return er else : return bpe
Returns the entity reference of an entity if it exists or
        return the entity reference that was passed in as argument.