<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def select_fields(self, fields):
 """ Return a new SGraph with only the selected fields. Other fields are discarded, while fields that do not exist in the SGraph are ignored. Parameters fields : string | list [string] A single field name or a list of field names to select. Returns ------- out : SGraph A new graph whose vertex and edge data are projected to the selected fields. See Also -------- get_fields, get_vertex_fields, get_edge_fields Examples -------- Vertex(1, attr={'breed': 'labrador', 'age': 3}), Vertex(2, attr={'breed': 'vizsla', 'age': 8})] """


        if (type(fields) is str):
            fields = [fields]
        if not isinstance(fields, list) or not all(type(x) is str for x in fields):
            raise TypeError('\"fields\" must be a str or list[str]')

        vfields = self.__proxy__.get_vertex_fields()
        efields = self.__proxy__.get_edge_fields()
        selected_vfields = []
        selected_efields = []
        for f in fields:
            found = False
            if f in vfields:
                selected_vfields.append(f)
                found = True
            if f in efields:
                selected_efields.append(f)
                found = True
            if not found:
                raise ValueError('Field \'%s\' not in graph' % f)

        with cython_context():
            proxy = self.__proxy__
            proxy = proxy.select_vertex_fields(selected_vfields)
            proxy = proxy.select_edge_fields(selected_efields)
            return SGraph(_proxy=proxy)