Php Array Merge If Not Empty Python Code