def get_complex_part(expr, no, prec, options):
 workprec = prec
 i = 0
 while 1:
  res = evalf(expr, workprec, options)
  (value, accuracy) = res[no::2]
  if ((not value) or (accuracy >= prec) or ((- value[2]) > prec)):
   return (value, None, accuracy, None)
  workprec += max(30, (2 ** i))
  i += 1

def get_complex_part ( expr , no , prec , options ) : workprec = prec i = 0 while 1 : res = evalf ( expr , workprec , options ) ( value , accuracy ) = res [ no : : 2 ] if ( ( not value ) or ( accuracy >= prec ) or ( ( - value [ 2 ] ) > prec ) ) : return ( value , None , accuracy , None ) workprec += max ( 30 , ( 2 ** i ) ) i += 1
no = 0 for real part .