substitute tabs with 4 spaces starting on $dir and its subdirs on files ending with $ext
#!/bin/sh

# always use full paths
dir=/home/user/code
ext=py
tmpFile="/tmp/ftabs2spaces"

find $dir -name \*.$ext > $tmpFile

while read file;
do
 fileBak=$file.bak
 echo $file "->" $fileBak
 mv $file $file.bak
 cat $fileBak | sed -e 's/[\t]/    /g' > $file
done < $tmpFile