improve actions python code