Write a function that takes a list of numbers and returns its median. No external library such as numpy cannot be used. All tests would fail if any library is imported in your solution.
numpy
median([13, 9, 18, 13, 6, 8, 5, 12, 17, 8]) -> 10.5
Test 1    
Test 2    
Test 3    
Test 4