BEGIN{
    classname = ""
    FS = "[ |(,]"
    printf "[\n"
}
{
    #print "1: "$1 " 2: "$2 " 3: "$3 " 4: "$4
    if ($1 == "class") {
        classname = $2
        printf "\t(pt_map.models." classname ", ["
    }else if ($0 == "" && classname != ""){
        printf "]),\n"
        classname = ""
    }else {
        fk = index($0, "models.ForeignKey")
        if (fk > 0) {
            first = match($0, /\(/)+1
            last = index(substr($0, first), ",")-1
            printf "(pt_map.models." substr($0, first, last) ", "
            first = match($0, /[a-z]/)          
            last = index(substr($0, first), " = ")-1
            printf "\'" substr($0, first, last) "\'), "
        }
    }
}
END{
    print "]"
}
