Python selenium object repository
If I were to use "find by" PageFactory-like notation in Python, I would go with the one proposed here - similar to your versions, but more concise and supports more features:

from pageobject_support import callable_find_by as find_by

class GoogleSearchPage(object):
    search_input = find_by(how=By.NAME, using='q')




Old Answer (in case there is anything useful there)

I would go further and follow the Page Object pattern, creating abstractions for the pages and elements you are working with, as demonstrated in the selenium documentation. This way you are isolating your locators from the logic of the test providing an "API" to work with a particular page.

Here is one way to do it - pay attention to how simple and concise the actual test has become:

import unittest

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys


class MainPageLocators(object):
    """A class for main page locators. All main page locators should come here"""
    SEARCH_INPUT = (By.NAME, 'q')


class BasePage(object):
    """Base class to initialize the base page that will be called from all pages"""

    def __init__(self, driver):
        self.driver = driver


class MainPage(BasePage):
    """Home page action methods come here."""

    def search(self, search_query):
        """Triggers the search"""
        search_input = self.driver.find_element(*MainPageLocators.SEARCH_INPUT)
        search_input.send_keys(search_query)
        search_input.send_keys(Keys.ENTER)


class TestGoogle(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Firefox()
        self.driver.get("https://google.com")

    def tearDown(self):
        self.driver.close()

    def test_search(self):
        main_page = MainPage(self.driver)
        main_page.search("selenium python")


Note that you may also want a separate class for an element, but this should be good enough to get you started.

Also note that I'm using a unittest.TestCase as a base class for your test which, aside from bringing other benefits, allows to nicely start and close a browser via setUp and tearDown.