how to check the element is field element
p=(3^151)
F1.<x>=GF(3)[]
F.<a>=GF(3^151,'a',modulus=x^151+2*x^2+1);
A=1
B1=(0x1fc4865afe00a9216b0b5fd32c6300c4bed0707ae4072a03e55299f157b);B1
B=F(B1.digits(3));B
D=F(B).field_element();D
how to check the element B is Field element, the command which i have written gave me attribute error.