<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def view_edit(name=None):
 """Edit or creates a new page. .. note:: this is a bottle view if no page name is given, creates a new page. Keyword Arguments: :name: (str) -- name of the page (OPTIONAL) Returns: bottle response object """

    response.set_header('Cache-control', 'no-cache')
    response.set_header('Pragma', 'no-cache')
    if name is None:
        # new page
        return template('edit',
                        type="edit",
                        name=name,
                        extended_name=None,
                        is_repo=check_repo(),
                        history=[],
                        gitref=None,
                        today=datetime.datetime.now().strftime("%Y%m%d"),
                        content="")
    else:
        files = glob.glob("{0}.rst".format(name))
        if len(files) > 0:
            file_handle = open(files[0], 'r')
            return template('edit',
                            type="edit",
                            name=name,
                            extended_name=None,
                            is_repo=check_repo(),
                            history=[],
                            gitref=None,
                            today=datetime.datetime.now().strftime("%Y%m%d"),
                            content=file_handle.read())
        else:
            return abort(404)