Base number converter

Hello, so i have to convert 3 base number to 10 base number for recursion, so far i have code to check if the following number is in 3 base, and i have code for convert from higher base number to lower (in this case from 10 base to 7 base):

This is non recursion code for check if the number is in 3 base

def isit3base(X):
  if(x>0):
    number=X%10
    X=X//10
    if(number>=3):
      return(False)
  else:
    return(True)
X=int(input("input number: "))
print(isit3base(X))

Converter from 10base to 7 base

def fromtentoseven(x):
  result=" "
  while(x>0):
    result+=str(x%7)
    x=x//7
  return(int(result[::-1]))
print(fromtentoseven(512))

#result will be 1331 in 7 base

Now i need to convert 3 base number to 10 base number in recursion.