from chatty import create
import config

from tornado.ioloop import PeriodicCallback, IOLoop
from functools import partial


if __name__ == "__main__":
    chat = create(config)

# Tell chat to authenticate with the beam server. It'll throw
# a chatty.errors.NotAuthenticatedError if it fails.
chat.authenticate(config.CHANNEL)

# Listen for incoming messages. When they come in, just print them.
chat.on("message", partial(print, "RECEIVE:"))

# Create a timer that sends the message "Hi!" every second.
PeriodicCallback(
    lambda: chat.message('Hi!'),
    1000
).start()

# Start the tornado event loop.
IOLoop.instance().start()
from chatty import create
import config

from tornado.ioloop import PeriodicCallback, IOLoop


if __name__ == "__main__":
    chat = create(config)

    # Tell chat to authenticate with the beam server. It'll throw
    # a chatty.errors.NotAuthenticatedError if it fails.
    chat.authenticate(config.CHANNEL)

    # Handle incoming messages.
    def on_message(message):
        print("RECEIVE:", message)
    
    # Listen for incoming messages. When they come in, just print them.
    chat.on("message", on_message)

    # Create a timer that sends the message "Hi!" every second.
    PeriodicCallback(
        lambda: chat.message('Hi!'),
        1000
    ).start()

    # Start the tornado event loop.
    IOLoop.instance().start()

Replace partial with a function definition
Replace partial with a function definition

Fix indentation, as well.
  from chatty import create
  import config
  
  from tornado.ioloop import PeriodicCallback, IOLoop
- from functools import partial
  
  
  if __name__ == "__main__":
      chat = create(config)
  
- # Tell chat to authenticate with the beam server. It'll throw
+     # Tell chat to authenticate with the beam server. It'll throw
- # a chatty.errors.NotAuthenticatedError if it fails.
+     # a chatty.errors.NotAuthenticatedError if it fails.
- chat.authenticate(config.CHANNEL)
+     chat.authenticate(config.CHANNEL)
  
+     # Handle incoming messages.
+     def on_message(message):
+         print("RECEIVE:", message)
+     
- # Listen for incoming messages. When they come in, just print them.
+     # Listen for incoming messages. When they come in, just print them.
- chat.on("message", partial(print, "RECEIVE:"))
+     chat.on("message", on_message)
  
- # Create a timer that sends the message "Hi!" every second.
+     # Create a timer that sends the message "Hi!" every second.
- PeriodicCallback(
+     PeriodicCallback(
-     lambda: chat.message('Hi!'),
+         lambda: chat.message('Hi!'),
-     1000
+         1000
- ).start()
+     ).start()
  
- # Start the tornado event loop.
+     # Start the tornado event loop.
- IOLoop.instance().start()
+     IOLoop.instance().start()
+ 
Replace partial with a function definition
## Code Before:
from chatty import create
import config

from tornado.ioloop import PeriodicCallback, IOLoop
from functools import partial


if __name__ == "__main__":
    chat = create(config)

# Tell chat to authenticate with the beam server. It'll throw
# a chatty.errors.NotAuthenticatedError if it fails.
chat.authenticate(config.CHANNEL)

# Listen for incoming messages. When they come in, just print them.
chat.on("message", partial(print, "RECEIVE:"))

# Create a timer that sends the message "Hi!" every second.
PeriodicCallback(
    lambda: chat.message('Hi!'),
    1000
).start()

# Start the tornado event loop.
IOLoop.instance().start()
## Instruction:
Replace partial with a function definition
## Code After:
from chatty import create
import config

from tornado.ioloop import PeriodicCallback, IOLoop


if __name__ == "__main__":
    chat = create(config)

    # Tell chat to authenticate with the beam server. It'll throw
    # a chatty.errors.NotAuthenticatedError if it fails.
    chat.authenticate(config.CHANNEL)

    # Handle incoming messages.
    def on_message(message):
        print("RECEIVE:", message)
    
    # Listen for incoming messages. When they come in, just print them.
    chat.on("message", on_message)

    # Create a timer that sends the message "Hi!" every second.
    PeriodicCallback(
        lambda: chat.message('Hi!'),
        1000
    ).start()

    # Start the tornado event loop.
    IOLoop.instance().start()
