import re


def is_module(content):
    """Checks if the contents are from a Lua module.

    It looks for a returned value at the end of the file. If it finds one, it's
    safe to assume that it's a module.

    content : str
        The Lua source code to check.
    """

    # We match any number of whitespace after the `return` in case of accidental
    # spacing on the user's part.
    #
    # Then we match any characters to catch variables (`return module`) and
    # functions (`return setmetatable(t1, t2)`)
    #
    # We're optionally matching any number of spaces at the end of the file
    # incase of a final newline, or accidentally added spaces after the value.
    return re.search(r"return\s+.*(\s+)?$", content)