Move utility methods to used in different places of the API to a module
These methods are used by both the api.issue and api.fork modules and
are close enough that we want to keep them in a near proximity.
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>