I tried with custom_filter, it worked for some small road network, but as for a big road network like the whole Sydney network, it didn't work. In the output file, there were still some other highway types that I didn't want.
custom_filter='["highway"~"motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|secondary_link|tertiary|tertiary_link|road|road_link|service|service_link\
unclassified|unclassified_link"]'
G=ox.core.graph_from_place('Sydney,Australia',network_type='drive', \
simplify=True, infrastructure='way["highway"]', custom_filter=custom_filter)