Generally yes, it's fine, as long as it's not game specific. Another way to look at it is to ask if other engines have that functionality out the box, and if they do then it could be seen as general purpose/non-specific code. Examples of code like that, which I myself have copied from other projects are; sprite/tile rendering, collision handling, audio, etc. Which I think covers you. :)