Moved to utils to avoid possible future circular import errors.