Python How To End A Function Early