Unfortunately, the "best practice" of today says it's better to import a 2 Gb library than write a function, given the choice.
Does the imported function do exactly what you need? No not quite - maybe write your own. Is it a complex function that will require a lot of testing? yes - an import is probably best. Are you likely to use other parts of the imported library in the future? Yes, then import may be a better choice. Will it look good on your CV? Lets face it everyone does it.