How to create an arrow geometry using python?
a very flexible way to do that is to use the Rigify addon. You enable it in the User Preferences -> Addons tab, look for Rigify and check it.

Now, if you go to Edit Mode of ANY mesh, there's a button in the Transform Panel:



Rigify now creates the code needed to make this Object via Python. Go to a Text Editor, and select widget.py:



This is all the code you need, wrapped in a nice Python function. So to recap: Model your Mesh as you wish it to be, Apply all modifiers, and encode it using Rigify Dev Tools.